Test case name | Result |
---|---|
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 | |
decrement |
Test name | Executions per second |
---|---|
Simple for loop | 28500.4 Ops/sec |
Simple for loop (reverse) | 26210.5 Ops/sec |
Array.forEach | 35761.1 Ops/sec |
for loop + Array.entries | 12860.1 Ops/sec |
while + Array.entries | 11405.8 Ops/sec |
enumerable for loop (order not important) | 5435.4 Ops/sec |
enumerable for loop (order is respected) | 16608.3 Ops/sec |
Array.map | 31029.6 Ops/sec |
Array.filter | 36049.0 Ops/sec |
while + Array.entries (condensed) | 13270.2 Ops/sec |
for loop + Array.entries (condensed) | 14257.2 Ops/sec |
Simple for loop (condensed) | 29144.7 Ops/sec |
Instructionless for loop | 28002.0 Ops/sec |
decrement | 31067.5 Ops/sec |