2.1.4 • Published 8 years ago

benchmark v2.1.4

Weekly downloads
159,543
License
MIT
Repository
github
Last release
8 years ago

Benchmark.js v2.1.4

A robust benchmarking library that supports high-resolution timers & returns statistically significant results. As seen on jsPerf.

Documentation

Download

Installation

Benchmark.js’ only hard dependency is lodash. Include platform.js to populate Benchmark.platform.

In a browser:

<script src="lodash.js"></script>
<script src="platform.js"></script>
<script src="benchmark.js"></script>

In an AMD loader:

require({
  'paths': {
    'benchmark': 'path/to/benchmark',
    'lodash': 'path/to/lodash',
    'platform': 'path/to/platform'
  }
},
['benchmark'], function(Benchmark) {/*…*/});

Using npm:

$ npm i --save benchmark

In Node.js:

var Benchmark = require('benchmark');

Optionally, use the microtime module by Wade Simmons:

npm i --save microtime

Usage example:

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

Support

Tested in Chrome 54-55, Firefox 49-50, IE 11, Edge 14, Safari 9-10, Node.js 6-7, & PhantomJS 2.1.1.

BestieJS

Benchmark.js is part of the BestieJS “Best in Class” module collection. This means we promote solid browser/environment support, ES5+ precedents, unit testing, & plenty of documentation.

alex-d.jstiny-bencheni-chathorserace@horserace/core@everything-registry/sub-chunk-1226talladegatape-benchmarktape-benchmarkssymblwin-unc-perfwaitless-async-benchmarksweb-component-tester-bundleweb-tooling-benchmarkworker-functionteeny-perfspread-lab-scriptsspectrophotometerspeedyjs-benchmarksteal-benchmarktest.benchmarkthe-servat-trade-bot-indicatorstetrinodevtilsvektorvertexcullvoluptasveniam@discoursegroup/commons-test-js@dolphjs/core@critocrito/curry@cybermega/flutter-resource-manager-rs@rplan/asymptotic-guesser@pebula/touchstone@perfsee/packagejest-benchjest-worker-pluginjudyjest-performancejson-schema-benchmarkjsnarkjsfperfkarma-webpack-bundlekabsrpcdsugar-benchmarkstrifstreams-benchmarkua-benchmarkertldrawlignintirettravis-benchmarkwasmonkey@alicd/sugar@c4312/matcha@clevernature/benchmark-regression1000-packages@deep-foundation/materialized-pathybmyui-benchmarkya-basementxonewatsontrueno.io@faustbrian/benchmarker@gxchain2/evmc@howielee/mysql-cache@elioenaiferrari/bolt@galaxar/tester@etienne1698/benchmark_lib@futagoza/dev@fontoxml/fonto-benchmark-runner@genx/test@individe/libp2p-snappy-muxer@konceiver/benchmarker@lokua/bench@logsn/benchmarks@mrdesjardins/steganography@naturalcycles/bench-lib@niha-js/json-analyzer@niha-js/markdown-to-html-analyser@nathanpb/jest-bench@dyno.gg/pylon-client@mohism/bench@kaishen/quantlib@k/bench-runner@jamen/bench@johfe/perfsee-package@kitmi/tester@kodekeep/benchmarker@salesforce/oasis@sbj42/maze-generator-dev@nowarp/misti@ostera/rebench@parca/react-benchmark@peerbit/indexer-tests@smartholdem/benchmarker@soyjak/utils@remusao/bench@sharma-subendra-kr/rtreejs@srpc/cli
2.1.4

8 years ago

2.1.3

8 years ago

2.1.2

9 years ago

2.1.1

9 years ago

2.1.0

9 years ago

2.0.0

9 years ago

1.0.0

13 years ago

0.3.0

14 years ago

0.2.2

14 years ago

0.2.1

14 years ago

0.2.0

14 years ago

0.1.349

14 years ago

0.1.348

14 years ago

0.1.347

14 years ago

0.1.346

14 years ago

0.1.345

14 years ago

0.1.344

14 years ago

0.1.343

14 years ago

0.1.342

14 years ago

0.1.341

14 years ago

0.1.340

14 years ago

0.1.339

14 years ago

0.1.338

14 years ago

0.1.1338

14 years ago

0.1.4

14 years ago

0.1.337

14 years ago