Run details:
Mozilla/5.0 (Windows NT 6.1; WOW64; Trident/7.0; rv:11.0) like Gecko
IE 11
Windows 7
Other
2025 years ago
Test name Executions per second
For loop, basic 12864.0 Ops/sec
While loop, basic 12597.0 Ops/sec
For loop, cached (inside for statement) 17900.0 Ops/sec
For loop, cached (outside for statement) 18126.5 Ops/sec
For loop, i-- (caching inside for loop) 17582.5 Ops/sec
For loop, i-- (caching outside for loop) 18218.7 Ops/sec
While loop, cached 17770.2 Ops/sec
While loop, i-- 17905.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--