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 30108.5 Ops/sec
for..of 275717.8 Ops/sec
for+cache 30456.0 Ops/sec
for+cache+cache 54023.9 Ops/sec
for+cache+cache+cache 281866.7 Ops/sec
for..of+cache 276825.2 Ops/sec
foreach + cache+ arrow 278367.5 Ops/sec
foreach + cache+ func 272885.3 Ops/sec
foreach 277493.4 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