Run details:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/89.0.4389.90 Safari/537.36
Chrome 89
Mac OS X 10.13.6
Desktop
3 years ago
Test name Executions per second
for i++ array 1136813.0 Ops/sec
while ++i array 1141162.6 Ops/sec
for in array 747012.1 Ops/sec
for of array 11233206.0 Ops/sec
forEach array 9404871.0 Ops/sec
for in object 1011444.0 Ops/sec
for of values object 3244456.8 Ops/sec
for of pre-initialized-values object 11369523.0 Ops/sec
forEach pre-initialized-values object 9314770.0 Ops/sec
Script Preparation code:
Tests:
  • for i++ array

  • while ++i array

  • for in array

  • for of array

  • forEach array

  • for in object

  • for of values object

  • for of pre-initialized-values object

  • forEach pre-initialized-values object