forEach vs for

Benchmark created on


Setup

const membranes = Array.from(Array(1000)).map(i => ({value: Math.random()}))

Test runner

Ready to run.

Testing in
TestOps/sec
for
membranes.forEach(m => {
	m.value = 0
})
ready
forEach
const length = membranes.length
let i = 0

for (i = 0; i<length; i++) {
	membranes[i].value = 0
}
ready

Revisions

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