Run details:
Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:57.0) Gecko/20100101 Firefox/57.0
Firefox 57
Windows 7
Other
2025 years ago
Test name Executions per second
For loop, basic 2864.8 Ops/sec
While loop, basic 2972.4 Ops/sec
For loop, cached (inside for statement) 3549.1 Ops/sec
For loop, cached (outside for statement) 3606.1 Ops/sec
For loop, i-- (caching inside for loop) 3610.7 Ops/sec
For loop, i-- (caching outside for loop) 3697.6 Ops/sec
While loop, cached 3627.7 Ops/sec
While loop, i-- 3689.3 Ops/sec
forEach 4149.7 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


;