Micro benchmarking library for Node.JS 🚀
MIT License
A micro benchmarking library inspired from google-benchmark
Features available:
const { benchmark, show } = require('node-microbenchmark');
const slowFn = () => {
for (var i = 0; i < 1e4; ++i);
}
const fastFn = () => {}
benchmark(slowFn);
benchmark(fastFn);
show();
const benchmark = require('../index');
const slowTimer = () => new Promise(res => setTimeout(res, 200));
const fastTimer = () => new Promise(res => setTimeout(res, 50));
const fn = async () => {
await benchmark.benchmarkPromise(slowTimer);
await benchmark.benchmarkPromise(fastTimer);
benchmark.show();
};
fn();