Native#forEach with bind (v8)

Revision 8 of this benchmark created 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.4.1/lodash.min.js"></script>
<script>
var ld = _.noConflict();
</script>

Setup

var ld = window.ld,
        us = window.us,
        array = us.range(100);

Test runner

Ready to run.

Testing in
TestOps/sec
Underscore#forEach
var r = [];
us.forEach(array, function(v) {
  r.push(v);
});
ready
Lo-Dash#forEach
var r = [];
ld.forEach(array, function(v) {
  r.push(v);
});
ready
Native#forEach
var r = [];
array.forEach(function(v) {
  r.push(v);
});
ready
Lo-Dash#forEach with bind
var r = [];
ld.forEach(array, function(v, i) {
  r.push(v);
}, r);
ready
Native#for
var r = [];
for(var 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.