Ramda find

Benchmark created on


Setup

var nums = [8, 2, 85, 2, 34, 3, 23, 247, 57, 8, 0, 6, 5, 46, 54, 643];
function isZero(x) { return x === 0; }

function find(fn, list) {
  var idx = 0;
  var len = list.length;
  while (idx < len) {
    if (fn(list[idx])) {
      return list[idx];
    }
    idx += 1;
  }
}

Test runner

Ready to run.

Testing in
TestOps/sec
ramda
find(isZero, nums);
ready
native
nums.find(isZero);
ready

Revisions

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