How to use the benchmark.Benchmark function in benchmark

To help you get started, we’ve selected a few benchmark examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github aurelia / benchmarks / app / benchmarking / micro-runner.js View on Github external
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 });
        });
      });
github ds300 / derivablejs / scripts / bench.js View on Github external
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);
    }
  });