underscore / lodash

JavaScript performance comparison

Revision 3 of this test case created and last updated

Preparation code

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

Preparation code output

Test runner

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

Java applet disabled.

Testing in unknown unknown
Test Ops/sec
forEach underscore
r = [];
underscore.forEach(array, function(v) { r.push(v); });
forEach lodash
r = [];
lodash.forEach(array, function(v) { r.push(v); });
forEach native
r = [];
array.forEach(function(v) { r.push(v); });

Compare results of other browsers


You can edit these tests or add even more tests to this page by appending /edit to the URL. Here’s a list of current revisions for this page:


Comment form temporarily disabled.

Add a comment