benchmark.js

A benchmarking library. As used on jsPerf.com.

  • Owner: bestiejs/benchmark.js
  • Platform:
  • License:: Other
  • Category::
  • Topic:
  • Like:
    0
      Compare:

Github stars Tracking Chart

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.

Overview

Name With Ownerbestiejs/benchmark.js
Primary LanguageJavaScript
Program languageJavaScript (Language Count: 4)
Platform
License:Other
Release Count24
Last Release Name2.1.4 (Posted on 2017-03-28 10:02:33)
First Release Name0.1.337 (Posted on )
Created At2011-05-25 18:40:03
Pushed At2022-12-22 13:38:09
Last Commit At
Stargazers Count5.5k
Watchers Count100
Fork Count333
Commits Count1.2k
Has Issues Enabled
Issues Count169
Issue Open Count40
Pull Requests Count49
Pull Requests Open Count12
Pull Requests Close Count31
Has Wiki Enabled
Is Archived
Is Fork
Is Locked
Is Mirror
Is Private
To the top