collatio
TypeScript icon, indicating that this package has built-in type declarations

1.0.2 • Public • Published

collatio

make Performance Benchmarks for Javascript

Installation

npm install collatio

Usage

const {Benchmark} = require('collatio');

const b = new Benchmark('Test Loops');

b.setup(() => {
    const DATA = [];
    for (let i = 0; i < 1000000; i++) {
        DATA.push(i);
    }
    return DATA;
});

b.run('Array.filter', d => {
    d.filter(e => e > 3);
});

b.run('ts-tooling FindAll', d => {
    d.FindAll(e => e > 3);
});

b.run('for i loop', d => {
    const tmp = [];
    for (let i = 0; i < d.length; i++) {
        if (d[i] > 3) {
            tmp.push(d[i]);
        }
    }
});

// print the Data into the console
b.print(3);

// access the generated statistical data of the benchmark
console.info(b.stats);

Readme

Keywords

none

Package Sidebar

Install

npm i collatio

Weekly Downloads

1

Version

1.0.2

License

MIT

Unpacked Size

4.91 kB

Total Files

5

Last publish

Collaborators

  • nodejayes