Run details:
Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:106.0) Gecko/20100101 Firefox/106.0
Firefox 106
Ubuntu
Desktop
2 years ago
Test name Executions per second
Simple for loop 9672.6 Ops/sec
Simple for loop (reverse) 822.0 Ops/sec
Array.forEach 8897.6 Ops/sec
for loop + Array.entries 449.8 Ops/sec
while + Array.entries 443.8 Ops/sec
enumerable for loop (order not important) 45.1 Ops/sec
enumerable for loop (order is respected) 366.7 Ops/sec
Array.map 748.7 Ops/sec
Array.filter 625.1 Ops/sec
while + Array.entries (condensed) 693.2 Ops/sec
for loop + Array.entries (condensed) 686.8 Ops/sec
Simple for loop (condensed) 9572.2 Ops/sec
Instructionless for loop 9568.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


;