JSPM

  • Created
  • Published
  • Downloads 95358
  • Score
    100M100P100Q167466F
  • License MIT

cross-runtime benchmarking lib

Package Exports

  • mitata
  • mitata/reporter/fmt.mjs
  • mitata/src/cli.mjs

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (mitata) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

mitata

cross-runtime benchmarking lib


Install

bun add mitata

npm install mitata

Example

import { run, bench, group, baseline } from 'mitata';

// deno
// import { ... } from 'npm:mitata';

// d8/jsc
// import { ... } from '<path to mitata>/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)
});

License

MIT © Evan