Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
target.name,
Benchmark.formatNumber(hz.toFixed(2)),
rme.toFixed(2),
samples)
console.log(msg)
}
options.onError = function (bench) {
console.error(' ' + bench.target.error)
}
options.setup = function () {
this.count = Math.random() * 1000
this.nextInt = function (range) {
return Math.floor(this.count++ % range)
}
}
new Benchmark(name, fn, options).run()
}
function makeBench(fnToRun,name){
return new Benchmark({
defer: true,
name: name,
fn (deferred) {
fnToRun().then((result)=>{
if(result !== 4950){
console.error('bad result:' + result);
benchCoMws.abort();
}
deferred.resolve();
}).catch(console.log);
},
onError(err) {
console.error(err);
function benchmark(name: string, fn: () => void) {
const bench = new Benchmark(name, fn)
try {
fn()
bench
.on('complete', function(event: any) {
console.log(String(event.target))
})
.run()
} catch(e) {
console.log(`${name} threw an error: ${e}`)
}
}