Run details:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/125.0.0.0 Safari/537.36
Chrome 125
Mac OS X 10.15.7
Desktop
2 years ago
.forEach
21/s
for..of (reduce)
20/s
.for (init array)
20/s
.reduce (destructuring)
20/s
for..of
20/s
.reduce
18/s
for..of (destructuring)
14/s
.map
11/s
.map (destructuring)
10/s
for..of (reduce) (destructuring)
10/s
View exact numbers
Test name Executions per second
.forEach 21 Ops/sec
for..of (reduce) 20 Ops/sec
.for (init array) 20 Ops/sec
.reduce (destructuring) 20 Ops/sec
for..of 20 Ops/sec
.reduce 18 Ops/sec
for..of (destructuring) 14 Ops/sec
.map 11 Ops/sec
.map (destructuring) 10 Ops/sec
for..of (reduce) (destructuring) 10 Ops/sec
Script Preparation code:
Tests: