1.0.10 • Published 2 years ago

@marcosrv-ull/easybenchmarkjs v1.0.10

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/easybenchmarkjs

Usage from code:

const easybenchmarkjs = require('@marcosrv-ULL/easybenchmarkjs');
const fastBench = easybenchmarkjs.fastBench;

The documentation of the function.

Examples

This is the main idea of the function:

const easybenchmarkjs = require('@marcosrv-ULL/easybenchmarkjs');
const fastBench = easybenchmarkjs.fastBench;

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: ${easybenchmarkjs.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
1.0.10

2 years ago

1.0.9

2 years ago

1.0.8

2 years ago

1.0.7

2 years ago

1.0.6

2 years ago

1.0.5

2 years ago