Test forEach/for (v2)

Revision 2 of this benchmark created on


Setup

let arr = []
for (let i = 0; i < 1000000; i++) {
	arr.push(1)
}

Teardown

arr = undefined

Test runner

Ready to run.

Testing in
TestOps/sec
for
let v = 0
for (let i = 0; i < arr.length; i++) {
	v += arr[i]
}
ready
forEach
let v = 0
arr.forEach(arrV => v += arrV)
ready

Revisions

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