underscore / lodash

JavaScript performance comparison

Revision 16 of this test case created by

Preparation code

<script src="https://cdnjs.cloudflare.com/ajax/libs/underscore.js/1.4.4/underscore-min.js">
</script>
<script>
  var underscore = _.noConflict();
</script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/lodash.js/1.0.0-rc.3/lodash.min.js">
</script>
<script>
  var lodash = _.noConflict();
</script>
<script src='//rawgithub.com/dtao/lazy.js/master/lazy.js'></script>
      
<script>
Benchmark.prototype.setup = function() {
  var lodash = window.lodash,
      underscore = window.underscore,
      Lazy = window.Lazy;
  
  var r,
      array = [];
  
  for (var i = 0; i < 20; i++) {
    array[i] = i;
  }

};
</script>

Preparation code output

<script> var underscore = _.noConflict(); </script> <script src="https://cdnjs.cloudflare.com/ajax/libs/lodash.js/1.0.0-rc.3/lodash.min.js"> </script> <script> var lodash = _.noConflict(); </script> <script src='//rawgithub.com/dtao/lazy.js/master/lazy.js'></script>

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
map underscore
r = underscore.map(array, function(v) { return v; });
pending…
map lodash
r = lodash.map(array, function(v) { return v; });
pending…
map Lazy.js
r = Lazy(array).map(function(v) { return v; });
pending…
map native
r = array.map(function(v) { return v; });
pending…
for loop
r = [];
for (var i=0; i<array.length; i++) { r[i] = array[i]; }
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