Lo-Dash v2.2.1 vs Underscore v1.5.2 (v6)

Revision 6 of this benchmark created by 1000ch on


Description

Lo-Dash vs Underscore.

Preparation HTML

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

Setup

var ld = window.ld;
    var us = window.us;
    var r, array = [];
    for (var i = 0; i < 20; i++) {
      array[i] = i;
    }

Test runner

Ready to run.

Testing in
TestOps/sec
Underscore#forEach
r = [];
us.forEach(array, function(v) {
  r.push(v);
});
ready
Lo-Dash#forEach
r = [];
ld.forEach(array, function(v) {
  r.push(v);
});
ready
Native#forEach
r = [];
array.forEach(function(v) {
  r.push(v);
});
ready
Lo-Dash#forEach with bind
r = [];
ld.forEach(array, function(v) {
  r.push(v);
}, this);
ready
Native#for
r = [];
for(i = 0, len = array.length;i < len;i++) {
  r.push(array[i]);
}
ready

Revisions

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