Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
return new Promise(resolve => {
let benchmark;
let options = {
defer: true,
fn: fn,
onComplete: () => resolve({ period: benchmark.times.period, heapDeltas: heapDeltas })
};
benchmark = new Benchmark(name, options);
// force garbage collection
if (window.gc) {
window.gc();
}
benchmark.run({ async: true });
});
});
jsFiles.forEach(filename => {
const lib = filename.split(".")[1];
lib2results[lib] = [];
console.log("running", filename);
var fn = require(path.resolve(path.join(dir, filename)));
var b = new benchmark.Benchmark(lib, fn);
b.run();
lib2results[lib] = benchmark2json(b);
if (lib2results[lib].error) {
console.error(lib2results[lib].error);
}
});