Run details:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/119.0.0.0 Safari/537.36
Chrome 119
Mac OS X 10.15.7
Desktop
11 months ago
Test name Executions per second
Classic for loop 18299.4 Ops/sec
Optimised classic for loop 36794.1 Ops/sec
While loop 18727.0 Ops/sec
Optimised while loop 36609.3 Ops/sec
Array.prototype.forEach 275241.1 Ops/sec
Array.prototype.reduce 2930007.5 Ops/sec
For - of loop 745668.1 Ops/sec
For - in loop 26256.1 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


;