Run details:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/131.0.0.0 Safari/537.36
Chrome 131
Mac OS X 10.15.7
Desktop
one year ago
.forEach
35/s
for..of
34/s
for..of (destructuring)
28/s
.map
21/s
.map (destructuring)
10/s
for..of (reduce) (destructuring)
8/s
for..of (reduce)
8/s
.reduce (destructuring)
8/s
.reduce
7/s
.for (init array)
6/s
View exact numbers
Test name Executions per second
.forEach 35 Ops/sec
for..of 34 Ops/sec
for..of (destructuring) 28 Ops/sec
.map 21 Ops/sec
.map (destructuring) 10 Ops/sec
for..of (reduce) (destructuring) 8 Ops/sec
for..of (reduce) 8 Ops/sec
.reduce (destructuring) 8 Ops/sec
.reduce 7 Ops/sec
.for (init array) 6 Ops/sec
Script Preparation code:
Tests: