quick-bench
JavaScript Quick Benchmark Tool
Requirements
- NodeJS v5.11.x or higher
- NPM
See ./package.json
Installation
Source available on GitHub or install module via NPM:
$ npm install quick-bench
Usage
After requiring quick-benchmark create a new instance. Call the start method, log some events, then call the end method and finally
the results method to obtain quick benchmarks for JavaScript code.
var Benchmark = require('quick-bench')
var benchmark = new Benchmark()
benchmark.start()
benchmark.event('eventLabelOne')
benchmark.event('eventLabelOne')
benchmark.event('eventLabelTwo')
var results = benchmark.results()
The above will set the results
variable equal to an object with the following format:
{
elapsedTime: milliseconds,
events: {
eventLabelOne: {
total: 2,
perSecond: total / (elapsedTime / 1000)
},
eventLabelTwo: {
total: 1,
perSecond: total / (elapsedTime / 1000)
},
}
}
That's it! As the module name implies this package is designed for quick benchmarks.
License
MIT