Run details:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/126.0.0.0 Safari/537.36
Chrome 126
Mac OS X 10.15.7
Desktop
4 months ago
Test name Executions per second
Classic for loop 15152.5 Ops/sec
Optimised classic for loop 28270.7 Ops/sec
While loop 15154.4 Ops/sec
Optimised while loop 28216.8 Ops/sec
Array.prototype.forEach 271921.3 Ops/sec
Array.prototype.reduce 2686007.5 Ops/sec
For - of loop 733112.5 Ops/sec
For - in loop 22517.9 Ops/sec
Script Preparation code:
Tests:
  • Classic for loop

  • Optimised classic for loop

  • While loop

  • Optimised while loop

  • Array.prototype.forEach

  • Array.prototype.reduce

  • For - of loop

  • For - in loop


;