Run details:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/116.0.0.0 Safari/537.36
Chrome 116
Mac OS X 10.15.7
Desktop
2 years ago
for..of
42/s
for..of (reduce)
41/s
.reduce (destructuring)
33/s
.reduce
32/s
for..of (reduce) (destructuring)
30/s
for..of (destructuring)
29/s
.map
23/s
.forEach
19/s
.for (init array)
17/s
.map (destructuring)
16/s
View exact numbers
Test name Executions per second
for..of 42 Ops/sec
for..of (reduce) 41 Ops/sec
.reduce (destructuring) 33 Ops/sec
.reduce 32 Ops/sec
for..of (reduce) (destructuring) 30 Ops/sec
for..of (destructuring) 29 Ops/sec
.map 23 Ops/sec
.forEach 19 Ops/sec
.for (init array) 17 Ops/sec
.map (destructuring) 16 Ops/sec
Script Preparation code:
Tests: