Run details:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:109.0) Gecko/20100101 Firefox/110.0
Firefox 110
Mac OS X 10.15
Desktop
one year ago
Test name Executions per second
Simple for loop 1171083.9 Ops/sec
Simple for loop (reverse) 149312.8 Ops/sec
Array.forEach 968061.6 Ops/sec
for loop + Array.entries 83918.2 Ops/sec
while + Array.entries 83290.3 Ops/sec
enumerable for loop (order not important) 18430.4 Ops/sec
enumerable for loop (order is respected) 82586.1 Ops/sec
Array.map 386184.7 Ops/sec
Array.filter 299019.6 Ops/sec
while + Array.entries (condensed) 111596.4 Ops/sec
for loop + Array.entries (condensed) 111225.1 Ops/sec
Simple for loop (condensed) 1117630.2 Ops/sec
Instructionless for loop 1116800.1 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


;