Run details:
Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:109.0) Gecko/20100101 Firefox/120.0
Firefox 120
Windows
Desktop
6 months ago
Test name Executions per second
Simple for loop 1174548.2 Ops/sec
Simple for loop (reverse) 118508.1 Ops/sec
Array.forEach 952852.6 Ops/sec
for loop + Array.entries 39984.3 Ops/sec
while + Array.entries 39749.3 Ops/sec
enumerable for loop (order not important) 11790.5 Ops/sec
enumerable for loop (order is respected) 57799.6 Ops/sec
Array.map 108129.0 Ops/sec
Array.filter 83764.5 Ops/sec
while + Array.entries (condensed) 58895.5 Ops/sec
for loop + Array.entries (condensed) 59445.2 Ops/sec
Simple for loop (condensed) 911262.4 Ops/sec
Instructionless for loop 917149.6 Ops/sec
Script Preparation code:
Tests:
  • Simple for loop

  • Simple for loop (reverse)

  • Array.forEach

  • for loop + Array.entries

  • while + Array.entries

  • enumerable for loop (order not important)

  • enumerable for loop (order is respected)

  • Array.map

  • Array.filter

  • while + Array.entries (condensed)

  • for loop + Array.entries (condensed)

  • Simple for loop (condensed)

  • Instructionless for loop


;