How to use the benchmark/benchmark.Suite 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 Gozala / reducers / test / benchmark.js View on Github external
"use strict";

var map = require("../map")
var filter = require("../filter")
var reduce = require("../reduce")
var Benchmark = require("benchmark/benchmark")
var suite = Benchmark.Suite()

// Some helper functions we'll use
function increment(x) { return x + 1 }
function isOdd(n) { return n % 2 }
function range(from, to) {
  var items = []
  while (from < to) items.push(from++)
  return items
}
function sum(a, b) {
  return a + b
}

var numbers = range(0, 100000)

suite.add("standard array", function() {