Array map once vs map twice

Benchmark created on


Setup

let arr = [...Array(1_000_000).keys()]

Test runner

Ready to run.

Testing in
TestOps/sec
Map once
arr.map((i) => (i * i) / 25)
ready
Map twice
arr.map((i) => i * i).map((i) => i / 25) 
ready

Revisions

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