1.0.4 • Published 2 years ago

@marcosrv-ull/easybenchmark.js v1.0.4

Weekly downloads
-
License
ISC
Repository
github
Last release
2 years ago

npm version

easybenchmark.js

A really light tool to benchmark functions in js

Installation

For the package installation you only have to:

npm i @marcosrv-ull/easybenchmark.js

Usage from code:

const { fastBench } = require('@marcosrv-ULL/easybenchmark.js');

The documentation of the function.

Examples

This is the main idea of the function:

const { fastBench } = require('@marcosrv-ULL/easybenchmark.js');

const myFunction = (whatEverAreTheParams) => {
    // Do things
}

const TIMES_TO_BE_EXECUTED = 10;
let argumentA;
let argumentB;
.
.
.
let argumentN;
console.log(`Mean time elapsed with ${TIMES_TO_BE_EXECUTED} executions: ${fastBench(myFunction, [argumentA, argumentB, ..., argumentN], TIMES_TO_BE_EXECUTED)} ms`);

Output:

Mean time elapsed with 10 executions: <result_in_ms> ms

Author

marcosrv-ull

Tests

Execute:

npm run versions
mocha