Run details:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/63.0.3239.132 Safari/537.36
Chrome 63
Mac OS X 10.13.3
Other
2025 years ago
Test name Executions per second
For loop, basic 270.9 Ops/sec
While loop, basic 269.0 Ops/sec
For loop, cached (inside for statement) 340.6 Ops/sec
For loop, cached (outside for statement) 344.0 Ops/sec
For loop, i-- (caching inside for loop) 333.9 Ops/sec
For loop, i-- (caching outside for loop) 346.2 Ops/sec
While loop, cached 346.6 Ops/sec
While loop, i-- 344.2 Ops/sec
forEach 439.3 Ops/sec
Script Preparation code:
Tests:
  • For loop, basic

  • While loop, basic

  • For loop, cached (inside for statement)

  • For loop, cached (outside for statement)

  • For loop, i-- (caching inside for loop)

  • For loop, i-- (caching outside for loop)

  • While loop, cached

  • While loop, i--

  • forEach


;