1.0.2 ā€¢ Published 5 years ago

exacta v1.0.2

Weekly downloads
2
License
MIT
Repository
github
Last release
5 years ago

Exacta šŸ†

Benchmarking library.

Features

  • Lightweight
  • Zero dependencies
  • Easy to use with your favourite test framework

Install

npm i exacta --save-dev
or
yarn add exacta --dev

Use

Among other use cases, you can run a benchmark as part of your test suite:

const Race = require('exacta')

const fn1 = require('./fn1')
const fn2 = require('./fn2')

const param1 = [1, 2, 3]
const param2 = 'your string'

test(`benchmark`, () => {
  new Race()
    .setRuns(100000) // optional, defaults to 1000
    .addFn(fn1) // add functions to run...
    .addFn(fn2) // ...as many as you have, one at a time
    .setParams(param1, param2) // add parameters that functions take
    .run() // and finally let them run
})

it will output something like this:

--= Race results =--

# of runs: 100000
Parameters: [[1,2,3],"your string"]

Function                Run time [ā†“]
====================================
šŸ† fn1()                10 ms
------------------------------------
   fn2()                20 ms
------------------------------------

Author

Roman Krayovskyy (rkrayovskyy@gmail.com)

The name

Exacta stands for a method of betting, as on a horserace, in which the bettor must correctly pick those finishing in the first and second places in precisely that sequence. (https://www.thefreedictionary.com/exacta)

License

MIT