Run details:
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/122.0.0.0 Safari/537.36
Chrome 122
Windows
Desktop
10 months ago
Test name Executions per second
.forEach 29.7 Ops/sec
for..of 9.5 Ops/sec
for..of (destructuring) 12.5 Ops/sec
.map 16.8 Ops/sec
.map (destructuring) 11.6 Ops/sec
.for (init array) 7.6 Ops/sec
.reduce 10.7 Ops/sec
.reduce (destructuring) 17.6 Ops/sec
for..of (reduce) 27.5 Ops/sec
for..of (reduce) (destructuring) 28.8 Ops/sec
Script Preparation code:
Tests:
  • .forEach

  • for..of

  • for..of (destructuring)

  • .map

  • .map (destructuring)

  • .for (init array)

  • .reduce

  • .reduce (destructuring)

  • for..of (reduce)

  • for..of (reduce) (destructuring)