Run details:
Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/63.0.3239.108 Safari/537.36
Chrome 63
Windows 7
Other
2025 years ago
Test name Executions per second
For loop, basic 2836.7 Ops/sec
While loop, basic 2706.6 Ops/sec
For loop, cached (inside for statement) 4114.5 Ops/sec
For loop, cached (outside for statement) 4140.5 Ops/sec
For loop, i-- (caching inside for loop) 4020.6 Ops/sec
For loop, i-- (caching outside for loop) 4164.5 Ops/sec
While loop, cached 3979.1 Ops/sec
While loop, i-- 4173.9 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--