How to use the benchmark.each 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 lopatin / SnakeTron / old / public / libs / handlebars / bench / benchwarmer.js View on Github external
winners: function(benches) {
    var result = Benchmark.filter(benches, function(bench) { return bench.cycles; });

    if (result.length > 1) {
      result.sort(function(a, b) { return b.compare(a); });
      first = result[0];
      last  = result[result.length - 1];

      var winners = [];

      Benchmark.each(result, function(bench) {
        if (bench.compare(first) === 0) {
          winners.push(bench);
        }
      });

      return winners;
    } else {
      return result;
    }
  },
  suite: function(suite, fn) {