Run details:
Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/77.0.3833.122 Safari/537.36
Chrome 77
Windows
Desktop
4 years ago
Test name Executions per second
for of 24524.6 Ops/sec
for in 6571.6 Ops/sec
for 13983.7 Ops/sec
while 13887.8 Ops/sec
forEach() with function 33387.2 Ops/sec
forEach() with closure 24179.5 Ops/sec
for, reversed 12797.7 Ops/sec
for, cached length 2606.6 Ops/sec
while, reversed 55265.9 Ops/sec
while, cached length 1961.9 Ops/sec
HTML Preparation code:
Script Preparation code:
Tests:
  • for of

  • for in

  • for

  • while

  • forEach() with function

  • forEach() with closure

  • for, reversed

  • for, cached length

  • while, reversed

  • while, cached length