Run details:
Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:57.0) Gecko/20100101 Firefox/57.0
Firefox 57
Windows
Other
2025 years ago
Test name Executions per second
For loop, basic 2799.1 Ops/sec
While loop, basic 2848.1 Ops/sec
For loop, cached (inside for statement) 3307.9 Ops/sec
For loop, cached (outside for statement) 3483.5 Ops/sec
For loop, i-- (caching inside for loop) 3390.6 Ops/sec
For loop, i-- (caching outside for loop) 3422.2 Ops/sec
While loop, cached 3402.9 Ops/sec
While loop, i-- 3456.5 Ops/sec
forEach 3650.1 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


;