Socket
Socket
Sign inDemoInstall

bench-chain

Package Overview
Dependencies
178
Maintainers
1
Versions
19
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    bench-chain

benchmark recording - averages & graphs.


Version published
Maintainers
1
Created

Readme

Source

🏋️⛓ bench-chain

chainable benchmark recording - averages & graphs.

Build Status NPM version MIT License bench-chain Dependencies fluents

screen shot 2017-04-24 at 5 51 21 am

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

🔋 battery parsing when available - will be used for comparing more benchmark results with averages - amperage (number) - currentCapacity (number) - percent (number) - charging (boolean) - temp (number)
  • 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
screen shot 2017-04-29 at 9 08 50 pm

grouped by tags

screen shot 2017-05-01 at 5 45 33 am

progress bars

digress progress

Keywords

FAQs

Last updated on 10 May 2017

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc