array.forEach(fn.bind(context) vs. array.forEach(fn, context); (v4)

Revision 4 of this benchmark created on


Preparation HTML

<script>
  var testArray = [1, 2, 3, 4, 5, 6];
</script>

Test runner

Ready to run.

Testing in
TestOps/sec
forEach(fn.bind(ctx))
var blah = 0;
testArray.forEach(function(num) {
 blah += num;
}.bind(this));
ready
forEach(fn, ctx)
var blah = 0;
testArray.forEach(function(num) {
 blah += num;
}, this);
ready
var blah = 0;
testArray.forEach(function(num) {
 blah += num;
});
ready

Revisions

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