forEach vs. for (v19)

Revision 19 of this benchmark created on


Description

[].forEach vs for

Preparation HTML

<script>
var test = [10,24,32,'test', 'foo'];
var x = [];
</script>

Test runner

Ready to run.

Testing in
TestOps/sec
for
for (var i = 0, imax = test.length; i < imax; i++) {
x.push(test[i]);
}
ready
forEach()
test.forEach(function(element, index, array) {
   x.push(element);
});
ready

Revisions

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