Run details:
Mozilla/5.0 (X11; Linux x86_64; rv:109.0) Gecko/20100101 Firefox/115.0
Firefox 115
Linux
Desktop
10 months ago
Test name Executions per second
Simple for loop 348192.0 Ops/sec
Simple for loop (reverse) 46416.1 Ops/sec
Array.forEach 339556.6 Ops/sec
for loop + Array.entries 32404.2 Ops/sec
while + Array.entries 32400.1 Ops/sec
enumerable for loop (order not important) 7124.1 Ops/sec
enumerable for loop (order is respected) 31402.8 Ops/sec
Array.map 118417.1 Ops/sec
Array.filter 108283.4 Ops/sec
while + Array.entries (condensed) 39382.9 Ops/sec
for loop + Array.entries (condensed) 41100.4 Ops/sec
Simple for loop (condensed) 350574.7 Ops/sec
Instructionless for loop 350239.2 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