mitata-commonjs
v0.1.0
Published
cross-runtime benchmarking lib
Downloads
1,298
Readme
Install
bun add mitata-commonjs
npm install mitata-commonjs
Example
import { run, bench, group, baseline } from "mitata-commonjs";
// deno
// import { ... } from 'npm:mitata-commonjs';
// d8/jsc
// import { ... } from '<path to mitata-commonjs>/src/cli.mjs';
bench("noop", () => {});
bench("noop2", () => {});
group("group", () => {
baseline("baseline", () => {});
bench("Date.now()", () => Date.now());
bench("performance.now()", () => performance.now());
});
group({ name: "group2", summary: false }, () => {
bench("new Array(0)", () => new Array(0));
bench("new Array(1024)", () => new Array(1024));
});
await run({
units: false, // print small units cheatsheet
silent: false, // enable/disable stdout output
avg: true, // enable/disable avg column (default: true)
json: false, // enable/disable json output (default: false)
colors: true, // enable/disable colors (default: true)
min_max: true, // enable/disable min/max column (default: true)
percentiles: false, // enable/disable percentiles column (default: true)
});