Test forEach/for

Benchmark created on


Setup

let arr = []
for (let i = 0; i < 100000; 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.