Run details:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/122.0.0.0 Safari/537.36
Chrome 122
Mac OS X 10.15.7
Desktop
2 years ago
for..of (reduce)
45/s
for..of (reduce) (destructuring)
44/s
.reduce
43/s
.reduce (destructuring)
41/s
for..of
41/s
for..of (destructuring)
31/s
.for (init array)
31/s
.forEach
28/s
.map
26/s
.map (destructuring)
8/s
View exact numbers
Test name Executions per second
for..of (reduce) 45 Ops/sec
for..of (reduce) (destructuring) 44 Ops/sec
.reduce 43 Ops/sec
.reduce (destructuring) 41 Ops/sec
for..of 41 Ops/sec
for..of (destructuring) 31 Ops/sec
.for (init array) 31 Ops/sec
.forEach 28 Ops/sec
.map 26 Ops/sec
.map (destructuring) 8 Ops/sec
Script Preparation code:
Tests: