Script Preparation code:
Tests:

Historical Performance Data aggregated from 106 community runs

Desktop Results:
Chrome 71 runs
for ... of
9.6M/s
forEach
9.6M/s
View exact numbers
  • for ... of: 9,604,623 ops/sec
  • forEach: 9,555,760 ops/sec
Firefox 21 runs
forEach
44.4M/s
for ... of
12.6M/s

Fastest: forEach (3.5x faster)

View exact numbers
  • forEach: 44,440,968 ops/sec
  • for ... of: 12,595,440 ops/sec
Safari 6 runs
forEach
57.2M/s
for ... of
23.0M/s

Fastest: forEach (2.5x faster)

View exact numbers
  • forEach: 57,216,408 ops/sec
  • for ... of: 22,982,204 ops/sec
Mobile Results:
Chrome 8 runs
forEach
5.8M/s
for ... of
5.6M/s
View exact numbers
  • forEach: 5,833,726 ops/sec
  • for ... of: 5,602,154 ops/sec

Results show median performance across all community submissions. Run this benchmark yourself to verify on your device.

Rendered benchmark preparation results:

Suite status: <idle, ready to run>

Previous results
  • Test case name Result
    forEach
    for ... of

    Fastest: N/A

    Slowest: N/A

Latest run results:
Run details: (Test run date: 2 days ago)
Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/151.0.0.0 Safari/537.36
Chrome 151 on Linux
View result in a separate tab
for ... of
3.9M/s
forEach
3.8M/s
View exact numbers
Test name Executions per second
for ... of 3,864,720 Ops/sec
forEach 3,768,374 Ops/sec