Run details:
Mozilla/5.0 (X11; Linux x86_64; rv:122.0) Gecko/20100101 Firefox/122.0
Firefox 122
Linux
Desktop
10 months ago
Test name Executions per second
Simple for loop 1717703.9 Ops/sec
Simple for loop (reverse) 229616.1 Ops/sec
Array.forEach 337209.9 Ops/sec
for loop + Array.entries 61053.4 Ops/sec
while + Array.entries 60485.0 Ops/sec
enumerable for loop (order not important) 9143.7 Ops/sec
enumerable for loop (order is respected) 104321.4 Ops/sec
Array.map 203936.2 Ops/sec
Array.filter 177211.3 Ops/sec
while + Array.entries (condensed) 79026.1 Ops/sec
for loop + Array.entries (condensed) 81539.9 Ops/sec
Simple for loop (condensed) 1728597.4 Ops/sec
Instructionless for loop 1727966.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