ramda times perf improvement

Benchmark created on


Setup

function current(fn, n) {
  var len = Number(n);
  var idx = 0;
  var list;

  if (len < 0 || isNaN(len)) {
    throw new RangeError('n must be a non-negative number');
  }
  list = [];
  while (idx < len) {
    list.push(fn(idx));
    idx += 1;
  }
  return list;
}

function next(fn, n) {
  var len = Number(n);

  if (len < 0 || isNaN(len)) {
    throw new RangeError('n must be a non-negative number');
  }

  var idx = 0;
  var list = Array(len);
  while (idx < len) {
    list[idx] = fn(idx);
    idx += 1;
  }
  return list;
}

Test runner

Ready to run.

Testing in
TestOps/sec
Current
current(() => 'a', 10000);
ready
Next
next(() => 'a', 10000);
ready

Revisions

You can edit these tests or add more tests to this page by appending /edit to the URL.