Run details:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/119.0.0.0 Safari/537.36
Chrome 119
Mac OS X 10.15.7
Desktop
2 years ago
.forEach
39/s
for..of
37/s
for..of (destructuring)
31/s
for..of (reduce) (destructuring)
20/s
.for (init array)
20/s
.map
12/s
for..of (reduce)
7/s
.reduce
6/s
.reduce (destructuring)
6/s
.map (destructuring)
5/s
View exact numbers
Test name Executions per second
.forEach 39 Ops/sec
for..of 37 Ops/sec
for..of (destructuring) 31 Ops/sec
for..of (reduce) (destructuring) 20 Ops/sec
.for (init array) 20 Ops/sec
.map 12 Ops/sec
for..of (reduce) 7 Ops/sec
.reduce 6 Ops/sec
.reduce (destructuring) 6 Ops/sec
.map (destructuring) 5 Ops/sec
Script Preparation code:
Tests: