Run details:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36
Chrome 120
Mac OS X 10.15.7
Desktop
2 years ago
for..of (reduce)
150K/s
for..of (reduce) (destructuring)
150K/s
for..of
144K/s
.forEach
138K/s
.for (init array)
128K/s
.reduce
116K/s
.reduce (destructuring)
115K/s
for..of (destructuring)
105K/s
.map (destructuring)
102K/s
.map
102K/s
View exact numbers
Test name Executions per second
for..of (reduce) 149,802 Ops/sec
for..of (reduce) (destructuring) 149,635 Ops/sec
for..of 144,124 Ops/sec
.forEach 137,824 Ops/sec
.for (init array) 128,094 Ops/sec
.reduce 116,141 Ops/sec
.reduce (destructuring) 115,085 Ops/sec
for..of (destructuring) 104,607 Ops/sec
.map (destructuring) 102,276 Ops/sec
.map 102,006 Ops/sec
Script Preparation code:
Tests: