Run details:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.0.3770.100 Safari/537.36
Chrome 75
Mac OS X 10.14.5
Desktop
5 years ago
Test name Executions per second
For loop, basic 5395.1 Ops/sec
While loop, basic 5502.5 Ops/sec
For loop, cached (inside for statement) 8404.3 Ops/sec
For loop, cached (outside for statement) 8283.4 Ops/sec
For loop, i-- (caching inside for loop) 8246.9 Ops/sec
For loop, i-- (caching outside for loop) 8452.6 Ops/sec
While loop, cached 8407.5 Ops/sec
While loop, i-- 8447.9 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--