@marcosrv-ull/easybenchmarkjs

1.0.10 • Public • Published

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

Package Sidebar

Install

npm i @marcosrv-ull/easybenchmarkjs

Weekly Downloads

1

Version

1.0.10

License

ISC

Unpacked Size

1.57 MB

Total Files

30

Last publish

Collaborators

  • marcosrv-ull