lazy-demo (v11)

Revision 11 of this benchmark created by jdochen on


Preparation HTML

<script src="https://cdn.rawgit.com/lodash/lodash/3.0.0/lodash.js"></script>

Setup

var arr = _.range(10000),
        limit = 100;
        
    var odd = function(v) { return !!(v % 2); },
        square = function(v) { return v * v; };

Test runner

Ready to run.

Testing in
TestOps/sec
regular
var r = _.take(_.filter(_.map(arr, square), odd), limit);
 
ready
lazy
var r = _(arr).map(square).filter(odd).take(limit).value();
 
ready

Revisions

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