npm.io
1.0.0 • Published 8 years ago

bench-press

Licence
MIT
Version
1.0.0
Deps
1
Size
3 kB
Vulns
0
Weekly
0
Stars
38

bench-press

Benchmark operations

Use

import benchpress from 'bench-press';

console.log(
    benchpress(() => myFunction())
);

// Running 1000 times took 54ms

Options

Message
console.log(
    benchpress(
        () => myFunction(),
        {
            message: 'myFunction ✖ ${iterations} = ${duration}',
        }
    )
);

// myFunction ✖ 1000 = 54
Iterations
console.log(
    benchpress(
        () => myFunction(),
        {
            iterations: 1e5,
        }
    )
);

// Running 100000 times took 54ms