custom array forEach (v18)

Revision 18 of this benchmark created on


Setup

var array = ["foo", "bar", "baz", "lorem", "ipsum", "lol", "cat"];
  
  var func = function() {
    2 + 2
  };
  
  Array.prototype.forEach1 = function(a) {
    for (var i = 0; i < this.length; i++) a(this[i], i, this)
  }

Test runner

Ready to run.

Testing in
TestOps/sec
custom forEach
array.forEach1(func);
ready
for()
for (var i = 0; i < array.length; i++) func();
ready

Revisions

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