Run details:
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.75 Safari/537.36
Chrome 86
Windows
Desktop
4 years ago
Test name Executions per second
for 30274.7 Ops/sec
for..of 278478.9 Ops/sec
for+cache 30421.4 Ops/sec
for+cache+cache 53460.5 Ops/sec
for+cache+cache+cache 280818.8 Ops/sec
for..of+cache 273173.2 Ops/sec
foreach + cache+ arrow 281922.5 Ops/sec
foreach + cache+ func 275075.5 Ops/sec
foreach 272328.2 Ops/sec
Script Preparation code:
Tests:
  • for

  • for..of

  • for+cache

  • for+cache+cache

  • for+cache+cache+cache

  • for..of+cache

  • foreach + cache+ arrow

  • foreach + cache+ func

  • foreach