For vs map

Benchmark created on


Setup

let arr = Array(10000000)
arr.fill(1)

Test runner

Ready to run.

Testing in
TestOps/sec
for
const res = []
for (let thing of arr) {
	res.push(thing ** 2)
}
ready
map
const res = arr.map(thing => thing ** 2)
ready

Revisions

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