Run details:
Mozilla/5.0 (iPhone; CPU iPhone OS 17_0_2 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/17.0 Mobile/15E148 Safari/604.1
Mobile Safari 17
iOS 17.0.2
Mobile
one year ago
Test name Executions per second
.forEach 51.9 Ops/sec
for..of 50.8 Ops/sec
for..of (destructuring) 42.5 Ops/sec
.map 42.9 Ops/sec
.map (destructuring) 39.4 Ops/sec
.for (init array) 40.7 Ops/sec
.reduce 30.7 Ops/sec
.reduce (destructuring) 5.8 Ops/sec
for..of (reduce) 37.0 Ops/sec
for..of (reduce) (destructuring) 15.9 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)