Run details:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:91.0) Gecko/20100101 Firefox/91.0
Firefox 91
Mac OS X 10.15
Desktop
3 years ago
Test name Executions per second
Simple for loop 453478.1 Ops/sec
Simple for loop (reverse) 10287.7 Ops/sec
Array.forEach 374898.6 Ops/sec
for loop + Array.entries 26441.7 Ops/sec
while + Array.entries 25626.1 Ops/sec
enumerable for loop (order not important) 5028.2 Ops/sec
enumerable for loop (order is respected) 20876.6 Ops/sec
Array.map 59965.3 Ops/sec
Array.filter 47042.2 Ops/sec
while + Array.entries (condensed) 37020.8 Ops/sec
for loop + Array.entries (condensed) 37217.7 Ops/sec
Simple for loop (condensed) 445656.3 Ops/sec
Instructionless for loop 473306.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


;