Home / Web programming, webdev / JavaScript / Writing micro-benchmarks edit
Try Documentalist, my app that offers fast, offline access to 190+ programmer API docs.

Use benchmark package (npm install benchmark, https://benchmarkjs.com/).
A simple benchmark in node:
var Benchmark = require('benchmark');

var suite = new Benchmark.Suite;

function f1() {
	return ['foo', 'bar'].includes('zeta');
}

var known = ['foo', 'bar'];
function f2() {
	return known.includes('zeta');
}

suite.add('f1', f1);
suite.add('f2', f2);
suite.on('cycle', function(event) {
  console.log(String(event.target));
})
suite.on('complete', function() {
  console.log('Fastest is ' + this.filter('fastest').map('name'));
})
suite.run({ 'async': true });

Feedback about page:

Feedback:
Optional: your email if you want me to get back to you:

Need fast, offline access to 190+ programmer API docs? Try my app Documentalist for Windows