Skip to content
This repository has been archived by the owner on Jul 9, 2023. It is now read-only.

tinylibs/tinybench.old

This branch is 93 commits ahead of bestiejs/benchmark.js:main.

Folders and files

NameName
Last commit message
Last commit date

Latest commit

353a51b · May 17, 2022
Apr 23, 2022
Mar 13, 2022
Mar 7, 2022
May 17, 2022
May 17, 2022
May 16, 2014
Mar 7, 2022
Mar 7, 2022
Mar 7, 2022
Apr 26, 2022
May 15, 2022
May 15, 2022
Mar 7, 2022
May 17, 2022

Repository files navigation

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

About

A benchmarking library. As used on jsPerf.com.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 84.7%
  • HTML 6.8%
  • CSS 4.7%
  • TypeScript 3.8%