Run details:
Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:62.0) Gecko/20100101 Firefox/62.0
Firefox 62
Ubuntu
Desktop
6 years ago
Test name Executions per second
For loop, basic 106104.1 Ops/sec
While loop, basic 105878.0 Ops/sec
For loop, cached (inside for statement) 148417.3 Ops/sec
For loop, cached (outside for statement) 145266.5 Ops/sec
For loop, i-- (caching inside for loop) 146427.2 Ops/sec
For loop, i-- (caching outside for loop) 149411.6 Ops/sec
While loop, cached 147504.7 Ops/sec
While loop, i-- 151303.2 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--