Underscore 1.5.2 VS lodash 2.1.0

JavaScript performance comparison

Test case created by David Granado

Preparation code

<script src="//cdnjs.cloudflare.com/ajax/libs/underscore.js/1.5.2/underscore-min.js"></script>
<script>
var underscore = _.noConflict();
</script>

<script src="//cdnjs.cloudflare.com/ajax/libs/lodash.js/2.1.0/lodash.min.js"></script>
<script>
var lodash = _.noConflict();
</script>
<script>
Benchmark.prototype.setup = function() {
    var list = [{
      key: 'val1'
    }, {
      key: 'val2'
    }];
};
</script>

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
Each - Underscore
underscore.each(list, function(val, key) {});
pending…
Each - Lodash
lodash.each(list, function(val, key) {});
pending…
Map - Underscore
underscore.map(list, function(val) {
  return val;
});
pending…
Map - Lodash
lodash.map(list, function(val) {
  return val;
});
pending…
Find - Underscore
underscore.find(list, function(val) {
  return false;
});
pending…
Find - Lodash
lodash.find(list, function(val) {
  return false;
});
pending…
Filter - Underscore
underscore.filter(list, function(val) {
  return true;
});
pending…
Filter - Lodash
lodash.filter(list, function(val) {
  return true;
});
pending…
Some - Underscore
underscore.some(list, function(val) {
  return false;
});
pending…
Some - Lodash
lodash.some(list, function(val) {
  return false;
});
pending…
Every - Underscore
underscore.every(list, function(val) {
  return false;
});
pending…
Every - Lodash
lodash.every(list, function(val) {
  return false;
});
pending…
Contains - Underscore
underscore.contains(list, function(val) {
  return false;
});
pending…
Contains - Lodash
lodash.contains(list, function(val) {
  return false;
});
pending…
Pluck - Underscore
underscore.pluck(list, 'key');
pending…
Pluck - Underscore
lodash.pluck(list, 'key');
pending…
Invoke - Underscore
underscore.invoke(list, "toString");
pending…
Invoke - Lodash
lodash.invoke(list, "toString");
pending…
Uniq - Underscore
underscore.uniq(list);
pending…
Uniq - Lodash
lodash.uniq(list);
pending…
Extend - Underscore
underscore.extend({
  foo: 'val'
}, {
  bar: 'val'
});
pending…
Extend - Lodash
lodash.extend({
  foo: 'val'
}, {
  bar: 'val'
});
pending…
Pick - Underscore
underscore.pick({
  foo: 'val',
  bar: 'val'
}, 'bar');
pending…
Pick - Lodash
lodash.pick({
  foo: 'val',
  bar: 'val'
}, 'bar');
pending…

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

Compare results of other browsers

0 comments

Add a comment