# benchmark

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

Latest version **2.1.4** (published 2017-03-28) · MIT license · 0 weekly downloads

## Install

```sh
npm install benchmark
pnpm add benchmark
yarn add benchmark
bun add benchmark
```

## Health

**Score 23/100 (F)** — status: abandoned.

Positive: has types package; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 2.1.4 |
| Published | 2017-03-28 |
| First published | 2010-12-28 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | separate (@types/benchmark) |
| Module format | CommonJS |
| Dependencies | 2 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 5454 |
| Author | Mathias Bynens |
| Maintainers | jdalton, mathias |
| Keywords | benchmark, performance, speed |

## Links

- npm: https://www.npmjs.com/package/benchmark
- Repository: https://github.com/bestiejs/benchmark.js
- Homepage: https://benchmarkjs.com/
- Issues: https://github.com/bestiejs/benchmark.js/issues
- npm.io page: https://npm.io/package/benchmark

## Dependencies (2)

- [lodash](https://npm.io/package/lodash.md) ^4.17.4
- [platform](https://npm.io/package/platform.md) ^1.3.3

## Alternatives

- [mobx-react](https://npm.io/package/mobx-react.md) — 2.8M weekly downloads
- [rc-tree](https://npm.io/package/rc-tree.md) — 2.6M weekly downloads
- [@react-oauth/google](https://npm.io/package/@react-oauth/google.md) — 1.3M weekly downloads
- [@wagmi/connectors](https://npm.io/package/@wagmi/connectors.md) — 877.0K weekly downloads
- [vee-validate](https://npm.io/package/vee-validate.md) — 836.4K weekly downloads

## Recent versions

- 2.1.4 (latest) — 2017-03-28
- 2.1.3 — 2016-12-24
- 2.1.2 — 2016-10-31
- 2.1.1 — 2016-07-20
- 2.1.0 — 2016-01-28
- 2.0.0 — 2016-01-04
- 1.0.0 — 2012-08-16
- 0.3.0 — 2011-12-04
- 0.2.2 — 2011-06-07
- 0.2.1 — 2011-04-25
- 0.2.0 — 2011-04-18
- 0.1.349 — 2011-04-04
- 0.1.348 — 2011-03-18
- 0.1.347 — 2011-03-10
- 0.1.346 — 2011-03-01
- … 9 more at https://npm.io/package/benchmark/versions

## README

# Benchmark.js v2.1.4

A [robust](https://mathiasbynens.be/notes/javascript-benchmarking "Bulletproof JavaScript benchmarks") benchmarking library that supports high-resolution timers & returns statistically significant results. As seen on [jsPerf](https://jsperf.com/).

## Documentation

* [API Documentation](https://benchmarkjs.com/docs)

## Download

 * [Development source](https://raw.githubusercontent.com/bestiejs/benchmark.js/2.1.4/benchmark.js)

## Installation

Benchmark.js’ only hard dependency is [lodash](https://lodash.com/).
Include [platform.js](https://mths.be/platform) to populate [Benchmark.platform](https://benchmarkjs.com/docs#platform).

In a browser:

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

In an AMD loader:

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

Using npm:

```shell
$ npm i --save benchmark
```

In Node.js:

```js
var Benchmark = require('benchmark');
```

Optionally, use the [microtime module](https://github.com/wadey/node-microtime) by Wade Simmons:

```shell
npm i --save microtime
```

Usage example:

```js
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.

---
_Source: https://npm.io/package/benchmark · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
