Skip to documentation

package

@stackline/benchmark 1.0.2 — installation and API

A benchmarking library that supports high-resolution timers & returns statistically significant results.

Install @stackline/benchmark

npm install @stackline/[email protected]

Package version: 1.0.2. Metadata verified: 2026-11-12. This is separate from the framework version and demonstration runtime.

Node.js requirement
{}
Accepted peer dependencies (declared ranges)
{}

Tested environments are described in the versioned README and linked source checks. A declared peer range is not evidence that every version in it was tested.

Versioned reference

This reference comes from the published @stackline/[email protected] README. Its upstream attribution and license remain with the source. Benchmark and security statements describe the cited tests and advisories, not a guarantee for every application.

@stackline/benchmark

A benchmarking library that supports high-resolution timers & returns statistically significant results.

Documentation | npm | Issues | Repository

Current package version: 1.0.2


Why this package?

@stackline/benchmark is the Stackline-maintained distribution of [email protected]. It is an independent continuation of benchmark; original authors and licenses remain credited below.

Compatibility

Item Value
Package @stackline/[email protected]
API target [email protected]
Supported Node.js See supported framework requirements
License MIT
Main entry benchmark.js
Runtime dependencies lodash, platform

Installation

npm install @stackline/benchmark

Preserve existing imports and plugin resolution with an npm alias:

npm install benchmark@npm:@stackline/benchmark

Usage and API reference

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': {
    '@stackline/benchmark': 'path/to/benchmark',
    'lodash': 'path/to/lodash',
    'platform': 'path/to/platform'
  }
},
['@stackline/benchmark'], function(Benchmark) {/*…*/});

Using npm:

$ npm i --save @stackline/benchmark

In Node.js:

var Benchmark = require('@stackline/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.

Credits and original authors

Original copyright, license notices and contributor acknowledgements remain part of this distribution. Stackline maintenance does not replace authorship of the original work.

License

MIT. See the license and notice files in the repository.

Use this repository's issue tracker for reproducible bugs and feature requests. Join r/Stackline for examples, usage questions and release discussions.