MAP vs MAP.MAP

Benchmark created on


Setup

const arr = []

for(let i = 0; i < 1000; i++)
	arr.push(Math.random())

Test runner

Ready to run.

Testing in
TestOps/sec
MAP
arr.map(a => (a + 1) * 2)
ready
MAP MAP
arr.map(a => a + 1).map(a => a * 2)
ready
FOR
let index = 0
for(const a of arr) {
		arr[index] = (a + 1) * 2
		index++
}
ready
FOR LOOP
  for (let i = 0; i < arr.length; i++) {
      arr[i] = (arr[i] + 1) * 2
    }
ready

Revisions

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