Run details:
Mozilla/5.0 (Windows NT 10.0; rv:112.0) Gecko/20100101 Firefox/112.0
Firefox 112
Windows
Desktop
one year ago
Test name Executions per second
.forEach 40.8 Ops/sec
for..of 41.4 Ops/sec
for..of (destructuring) 33.2 Ops/sec
.map 38.5 Ops/sec
.map (destructuring) 38.7 Ops/sec
.for (init array) 40.1 Ops/sec
.reduce 39.1 Ops/sec
.reduce (destructuring) 39.2 Ops/sec
for..of (reduce) 43.3 Ops/sec
for..of (reduce) (destructuring) 43.3 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)