ben
Benchmark synchronous and asynchronous snippets simply.
examples
synchronous
var ben = ; var ms = ; console;
output:
0.0024 milliseconds per iteration
asynchronous
var ben = ; var { ;}; ben;
output:
10.39 milliseconds per iteration
methods
ben(times=10000, testFn)
Return how many milliseconds it takes to execute testFn
.
testFn
will be executed times
many times.
alias: ben.sync()
ben.async(times=100, testFn, cb)
Compute how many milliseconds it takes to complete the asynchronous function
testFn
. testFn(done)
will be called with a done
callback to move along to
the next iteration.
After testFn
is run times
many times, cb
will be called with the number of
milliseconds on average that testFn
took to finish.
install
With npm, do:
npm install ben