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