lazy-demo (v7)

Revision 7 of this benchmark created on


Preparation HTML

<script src="https://raw.github.com/lodash/lodash/3.9.3/lodash.min.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), 100);
 
ready
lazy
var r = _(arr).map(square).filter(odd).take(100).value();
 
ready

Revisions

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