Script Preparation code:
Tests:

Historical Performance Data aggregated from 8 community runs

Desktop Results:
Chrome 8 runs
foreach with operation
4.3M/s
some
3.9M/s
for (lenght 另外儲存)
307K/s
for..of
247K/s
for (lenght 不另外儲存)
156K/s

Fastest: foreach with operation (27.4x faster)

View exact numbers
  • foreach with operation: 4,281,616 ops/sec
  • some: 3,929,353 ops/sec
  • for (lenght 另外儲存): 306,928 ops/sec
  • for..of: 247,221 ops/sec
  • for (lenght 不另外儲存): 156,141 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
    for (lenght 另外儲存)
    foreach with operation
    some
    for..of
    for (lenght 不另外儲存)

    Fastest: N/A

    Slowest: N/A

Latest run results:
Run details: (Test run date: 2 years ago)
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36
Chrome 120 on Mac OS X 10.15.7
View result in a separate tab
foreach with operation
4.3M/s
some
4.3M/s
for (lenght 另外儲存)
295K/s
for..of
251K/s
for (lenght 不另外儲存)
157K/s
View exact numbers
Test name Executions per second
foreach with operation 4,302,686 Ops/sec
some 4,290,174 Ops/sec
for (lenght 另外儲存) 294,736 Ops/sec
for..of 250,573 Ops/sec
for (lenght 不另外儲存) 156,694 Ops/sec