old v new

Benchmark created by buzz on


Preparation HTML

<script src="//rawgit.com/CrossEye/ramda/master/ramda.js"></script>

Setup

function newFind(fn, list) {
                 function _find(list) {
                     var idx = -1;
                     var len = list.length;
                     while (++idx < len) {
                         if (fn(list[idx])) {
                             return list[idx];
                         }
                     }
                     return undef;
                 }
                 return arguments.length < 2 ? _find : _find(list);         
    }
    
    list = [1,7,3,9,2003,30415,262,10120,10403,123, 563, 6, 2002, 20020];
    function pred(x) { return x > 100 && x % 2 === 0; }

Test runner

Ready to run.

Testing in
TestOps/sec
ramda.find
ramda.find(pred, list)
ready
newFind
newFind(pred, list)
ready

Revisions

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