ramda range perf improvement

Benchmark created on


Setup

function current(from, to) {
  var result = [];
  var n = from;
  while (n < to) {
    result.push(n);
    n += 1;
  }
  return result;
}

function next(from, to) {
  var result = Array(from < to ? to - from : 0);
  var finish = from < 0 ? to + Math.abs(from) : to - from;
  var idx = 0;
  while (idx < finish) {
    result[idx] = idx + from;
    idx += 1;
  }
  return result;
}

Test runner

Ready to run.

Testing in
TestOps/sec
Current
current(0, 10000)
ready
Next
next(0, 10000)
ready

Revisions

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