Benchmark operations
import benchpress from 'bench-press';
console.log(
benchpress(() => myFunction())
);
// Running 1000 times took 54ms
console.log(
benchpress(
() => myFunction(),
{
message: 'myFunction ✖ ${iterations} = ${duration}',
}
)
);
// myFunction ✖ 1000 = 54
console.log(
benchpress(
() => myFunction(),
{
iterations: 1e5,
}
)
);
// Running 100000 times took 54ms