loop

Benchmark created on


Setup

const ARR = Array.from({length: 10000}, (_, i) => i)

Test runner

Ready to run.

Testing in
TestOps/sec
map
const arrMap = ARR.map(v => v + 2)
ready
foreach
let arrForEach = []
ARR.forEach(v => arrForEach.push(v + 2))
ready
for
let arrForLoop = []
for (let i = 0; i < ARR.length; i++) {
	arrForLoop.push(ARR[i] + 2)
}
ready

Revisions

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