Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

benchmarkjs-pretty

Tiny wrapper around benchmarkjs with a simpler api

readme

Benchmarkjs pretty

This library is a tiny wrapper around the popular benchmarkjs but with a nicer api. It's always a bit cumbersome to specify the cycle and complete functions in each project where benchmarking is done.

Installation

# npm
npm install --save-dev benchmarkjs-pretty

# yarn
yarn add --dev benchmarkjs-pretty

Usage

import Benchmark from "benchmarkjs-pretty";

new Benchmark()
  .add("foo", myFunction)
  .add("bar", myOtherFunction)
  .run() // Returns promise

License

MIT, see LICENSE.

changelog

Changelog

2.0.0

  • Properly format ops/sec
  • Breaking change: Allow suites to set a title:
new Benchmark("My Benchmark")
  .add("foo", () => {})
  .run();

1.0.2

  • Fix errors in benchmarks getting swallowed

1.0.1

  • Fix missing typings when compiling via ts

1.0.0

  • initial Release