perfect-benchmark

1.0.3 • Public • Published

perfect-benchmark

The only Node.js benchmarking library you'll need.

Example screenshot

Installation

npm install perfect-benchmark

Usage

Basic Usage

The usage of perfect-benchmark is super simple. An example can be seen below:

const benchmark = require("perfect-benchmark");
 
benchmark(callback => {
        // do complex computing here...
 
        callback();
}, "complex stuff");

Advanced Usage

By default the function passed to benchmark is called 25 times, as can be seen in the screenshot above. If you need it to be executed a different amout of times, you can set the amount via benchmark's third parameter.

If you want to specify a callback to be called after the benchmark has completed, you can pass it as a fourth parameter.

The following example demonstrates these two features.

const benchmark = require("perfect-benchmark");
 
benchmark(callback => {
        // do complex computing here...
 
        callback();
}, "complex stuff", 5, () => {  // execute 5 times
    console.log("benchmarking complete!");
});

Package Sidebar

Install

npm i perfect-benchmark

Weekly Downloads

1

Version

1.0.3

License

MIT

Last publish

Collaborators

  • awstuff