0.5.1 • Published 7 years ago

bench-chain v0.5.1

Weekly downloads
14
License
MIT
Repository
github
Last release
7 years ago

🏋️⛓ bench-chain

chainable benchmark recording - averages & graphs.

Build Status NPM version MIT License bench-chain Dependencies fluents

extension of benchmark.js

📦 install

yarn add bench-chain
npm i bench-chain --save
const Bench = require('bench-chain')

🌐 documentation

🔬 tests

📘 examples

👋 basic

const Bench = require('bench-chain')

Bench
  // location to store benchmarks
  .init(__dirname, 'basic.json')
  // tag current benchmarks with, to mark what changes caused differences
  .tags('v1')
  // actual benchmarks
  .add('1 * 1', () => 1 * 1)
  .add('1 + 1', () => 1 + 1)
  .run()

💍 async

const Bench = require('bench-chain')

const sleep = sleepDuration => new Promise(resolve => setTimeout(resolve, sleepDuration))

Bench
  .init().dir(__dirname).filename('asyncs.json').setup()
  .name('sleepy')
  .tags('v1,v2')

  // can also use .add, and then .runAsync()
  .addAsync('sleep1', async done => {
    await sleep(1000)
    done()
  })
  .addAsync('sleep2', async done => {
    await sleep(2000)
    done()
  })
  .run()

🚩 flags

using funwithflags

  • --graph will show only the graph reporting, rather than run the benchmarks
  • --run-times=10 will run the test 10 times

📇 metadata

  • mem: operating system memory, nodejs memory
  • num: operations a second from benchmarkjs hertz
  • sampled: total runs samples from benchmarkjs
  • variation: variation from benchmarkjs
  • timesFor: microtime | performance.now times for beginning & end of each run
  • now: Date.now for changes over time

graphs for trends and variation

grouped by tags

progress bars

digress progress

0.5.2

7 years ago

0.5.1

7 years ago

0.5.0

7 years ago

0.4.3

7 years ago

0.4.2

7 years ago

0.4.1

7 years ago

0.4.0

7 years ago

0.3.0

7 years ago

0.2.0

7 years ago

0.1.2

7 years ago

0.1.1

7 years ago

0.1.0

7 years ago

0.0.7

7 years ago

0.0.6

7 years ago

0.0.5

7 years ago

0.0.4

7 years ago

0.0.3

7 years ago

0.0.2

7 years ago

0.0.1

7 years ago