Run details:
Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:122.0) Gecko/20100101 Firefox/122.0
Firefox 122
Windows
Desktop
10 months ago
Test name Executions per second
Simple for loop 908015.2 Ops/sec
Simple for loop (reverse) 93808.3 Ops/sec
Array.forEach 116615.9 Ops/sec
for loop + Array.entries 69260.5 Ops/sec
while + Array.entries 64915.5 Ops/sec
enumerable for loop (order not important) 12735.5 Ops/sec
enumerable for loop (order is respected) 72931.1 Ops/sec
Array.map 357836.3 Ops/sec
Array.filter 286372.9 Ops/sec
while + Array.entries (condensed) 94288.8 Ops/sec
for loop + Array.entries (condensed) 94938.3 Ops/sec
Simple for loop (condensed) 763512.2 Ops/sec
Instructionless for loop 1120547.4 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