Lo-Dash each vs Underscore each vs Native forEach (v3)

Revision 3 of this benchmark created on


Preparation HTML

<script src="//cdnjs.cloudflare.com/ajax/libs/underscore.js/1.4.1/underscore-min.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/lodash.js/0.8.2/lodash.min.js"></script>
<script>
 var lodash = _.noConflict();
 var pi = Math.PI,
 a = "t,t,t,t,t,t,t,t,t,t,t,t,t,t,t,t,t,t,t,t,t,t,t,t,t,t,t,t,t,t,t,t,t,t,t,t,t,t,t,t,t,t,t,t,t,t,t,t,t,t".split(","), e;
</script>

Test runner

Ready to run.

Testing in
TestOps/sec
Lo-Dash each
lodash.each(a, function(item) {
  item = pi;
});
ready
Underscore each
_.each(a, function(item) {
  item = pi;
});
ready
Native forEach
a.forEach(function(item) {
  item = pi;
});
ready
Native for
var cb = function(item) {
        item = pi;
    };
for (var ix = 0; ix < a.length; ix++) {
    cb(a[ix]);
}
ready
Native forEach v2
var cb = function(item) {
    item = pi;
};
a.forEach(cb);
ready

Revisions

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