Test case name | Result |
---|---|
Array.apply(null, Array(n)) | |
[...Array(n)] | |
Array(n).fill(null) | |
Array.from({ length: n }) | |
Array.from({ length:n }, (item, i) => i) |
Test name | Executions per second |
---|---|
Array.apply(null, Array(n)) | 85400.5 Ops/sec |
[...Array(n)] | 166490.1 Ops/sec |
Array(n).fill(null) | 439787.9 Ops/sec |
Array.from({ length: n }) | 293047.4 Ops/sec |
Array.from({ length:n }, (item, i) => i) | 534151.1 Ops/sec |