Run details:
Mozilla/5.0 (Linux; Android 10; K) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/122.0.0.0 Mobile Safari/537.36
Chrome Mobile 122
Android
Mobile
10 months ago
Test name Executions per second
Simple for loop 9198.9 Ops/sec
Simple for loop (reverse) 7672.8 Ops/sec
Array.forEach 62080.4 Ops/sec
for loop + Array.entries 12126.3 Ops/sec
while + Array.entries 12338.5 Ops/sec
enumerable for loop (order not important) 7031.3 Ops/sec
enumerable for loop (order is respected) 2650.5 Ops/sec
Array.map 53050.4 Ops/sec
Array.filter 44184.9 Ops/sec
while + Array.entries (condensed) 14468.4 Ops/sec
for loop + Array.entries (condensed) 14392.9 Ops/sec
Simple for loop (condensed) 8510.6 Ops/sec
Instructionless for loop 8499.5 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


;