Run details:
Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:105.0) Gecko/20100101 Firefox/105.0
Firefox 105
Windows
Desktop
2 years ago
Test name Executions per second
.forEach 22.7 Ops/sec
for..of 18.8 Ops/sec
for..of (destructuring) 14.2 Ops/sec
.map 17.0 Ops/sec
.map (destructuring) 15.0 Ops/sec
.for (init array) 16.5 Ops/sec
.reduce 16.9 Ops/sec
.reduce (destructuring) 16.7 Ops/sec
for..of (reduce) 16.0 Ops/sec
for..of (reduce) (destructuring) 15.6 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)