lodash-lazy

JavaScript performance comparison

Test case created by jdd

Preparation code

<script src="https://cdnjs.cloudflare.com/ajax/libs/underscore.js/1.7.0/underscore.js"></script>
<script src="https://cdn.rawgit.com/lodash/lodash/ad10a1eba55e9530a09827549f56d2886a900b7f/lodash.js"></script>
<script>var lodash = _.noConflict();</script>
      
<script>
Benchmark.prototype.setup = function() {
  var arr = _.range(10000),
      limit = 100;
  
  var square = function(v) { return v * v; },
      odd = function(v) { return !!(v % 2); };

};
</script>

Preparation code output

Test runner

Warning! For accurate results, please disable Firebug before running the tests. (Why?)

Java applet disabled.

Testing in CCBot 2.0.0 / Other 0.0.0
Test Ops/sec
Native
var r = arr.map(square).filter(odd).slice(0, limit);
pending…
Underscore
var r = _(arr).chain().map(square).filter(odd).take(limit).value();
pending…
Lo-Dash
var r = lodash(arr).map(square).filter(odd).take(limit).value();
pending…

Compare results of other browsers

Revisions

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

0 Comments