Run details:
Mozilla/5.0 (Windows NT 10.0; WOW64; rv:55.0) Gecko/20100101 Firefox/55.0
Firefox 55
Windows
Other
7 years ago
Test name Executions per second
Simple for loop 219422.4 Ops/sec
Simple for loop (reverse) 181833.6 Ops/sec
Array.forEach 2311733.5 Ops/sec
for loop + Array.entries 55286.5 Ops/sec
while + Array.entries 59888.4 Ops/sec
enumerable for loop (order not important) 7217.1 Ops/sec
enumerable for loop (order is respected) 64033.2 Ops/sec
Array.map 66224.3 Ops/sec
Array.filter 57834.3 Ops/sec
while + Array.entries (condensed) 83428.5 Ops/sec
for loop + Array.entries (condensed) 83394.2 Ops/sec
Simple for loop (condensed) 217659.2 Ops/sec
Instructionless for loop 217397.4 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


;