Run details:
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/89.0.4389.114 Safari/537.36
Chrome 89
Windows
Desktop
3 years ago
Test name Executions per second
for i++ array 856368.0 Ops/sec
while ++i array 868364.4 Ops/sec
for in array 523700.6 Ops/sec
for of array 8647803.0 Ops/sec
forEach array 7206679.0 Ops/sec
for in object 687447.2 Ops/sec
for of values object 2619440.2 Ops/sec
for of pre-initialized-values object 9102115.0 Ops/sec
forEach pre-initialized-values object 7505592.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