I am trying to execute a sample performance benchmark using Benchmark.js. Here is what I have wrote:
var Benchmark = require('benchmark');
var arr = []
benchmark = new Benchmark('testPerf',function(){
arr.push(1000);
},
{
delay: 0,
initCount: 1,
minSamples: 1000,
onComplete : function(){ console.log(this);},
onCycle: function(){}
});
benchmark.run();
Now like we do in JUnitBenchmarks:
@BenchmarkOptions(clock = Clock.NANO_TIME, callgc = true, benchmarkRounds = 10, warmupRounds = 1)
Here also I want to declare benchmarkRounds
and warmupRounds
count in benchmarkjs. I think warmupRounds
maps to initCount
? And how to set exact number of cycles/benchmark iteration?
Or if we have some other good JavaScript library that can handle it would work too.