benchmarked
Easily generate benchmarks from a glob of files.
This is an opinionated wrapper for benchmark.js to make it easier to do benchmarks. Concept is from remarkable.
Install
Install with npm:
$ npm i benchmarked
Usage
var Suite = require('benchmarked');
var suite = new Suite({
cwd: 'benchmark',
add: 'my-functions/*.js',
fixtures: 'my-fixtures/*.txt'
});
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:
suite.run(function (fixture) {
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({
name: function(filepath) {
return path.basename(filepath);
}
});
Contributing
Pull requests and stars are always welcome. For bugs and feature requests, please create an issue.
Running tests
Install dev dependencies:
$ npm i -d && npm test
Author
Jon Schlinkert
License
Copyright © 2014-2016 Jon Schlinkert
Released under the MIT license.
This file was generated by verb on January 25, 2016.