JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 2115
  • Score
    100M100P100Q108615F

Easily generate benchmarks from a glob of files.

Package Exports

  • benchmarked

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (benchmarked) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

benchmarked NPM version

Easily generate benchmarks from a glob of files.

This is an opinionated wrapper for benchmarked.js to make it easier to do benchmarks.

Install

Install with npm:

npm i benchmarked --save-dev

Run tests

npm test

Usage

var Suite = require('benchmarked');
var suite = new Suite({
  cwd: 'benchmark', // optionally define a current working directory
  add: 'my-functions/*.js', // path or glob pattern to functions
  fixtures: 'my-fixtures/*.txt'  // path or glob pattern to fixtures
});

// run the benchmarks
suite.run();

See the examples to get a better understanding of how this works.

Alternative setup

Add functions to run:

suite.add('benchmark/my-functions/*.js');

Add fixtures to use:

suite.fixtures('benchmark/my-fixtures/*.txt');

Run benchmarks for each fixture and function defined:

suite.run();

Pass additional arguments beyond the content in the fixtures:

// `fixture` is the content returned for each fixture
suite.run(function (fixture) {
  // this array will be applied as arguments to each function
  return [fixture, ':'];
});

Options

options.cwd

Specify a current working directory to be used for both fixtures and functions:

var suite = new Suite({cwd: 'example'});

options.name

Pass a custom naming function to be used on functions. This only changes the name that displays in the command line for each function:

var path = require('path');

var suite = new Suite({
  // this is the actual default
  name: function(filepath) {
    return path.basename(filepath);
  }
});

Author

Jon Schlinkert

License

Copyright (c) 2014 Jon Schlinkert, contributors.
Released under the MIT license


This file was generated by verb-cli on October 17, 2014.