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 173.7 Ops/sec
While loop, basic 180.4 Ops/sec
For loop, cached (inside for statement) 227.9 Ops/sec
For loop, cached (outside for statement) 234.0 Ops/sec
For loop, i-- (caching inside for loop) 229.8 Ops/sec
For loop, i-- (caching outside for loop) 234.2 Ops/sec
While loop, cached 231.5 Ops/sec
While loop, i-- 228.0 Ops/sec
forEach 305.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


;