Package Exports
- tinybench
- tinybench/benchmark.js
- tinybench/index.js
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 (tinybench) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
tinybench
A robust benchmarking library based on benchmark.js
Documentation
Installation
Using npm:
$ npm i --save tinybench
Optionally, use the microtime module by Wade Simmons:
npm i --save microtime
Usage example:
var Benchmark = require('tinybench');
var suite = new Benchmark.Suite;
// add tests
suite.add('RegExp#test', function() {
/o/.test('Hello World!');
})
.add('String#indexOf', function() {
'Hello World!'.indexOf('o') > -1;
})
// add listeners
.on('cycle', function(event) {
console.log(String(event.target));
})
.on('complete', function() {
console.log('Fastest is ' + this.filter('fastest').map('name'));
})
// run async
.run({ 'async': true });
// logs:
// => RegExp#test x 4,161,532 +-0.99% (59 cycles)
// => String#indexOf x 6,139,623 +-1.00% (131 cycles)
// => Fastest is String#indexOf