Test name | Executions per second |
---|---|
new Array() | 226192.2 Ops/sec |
Array.from() | 59619.7 Ops/sec |
[...Array()] | 222028.4 Ops/sec |
var mapfn = (_, index) => {
return index * 2 % 10;
}
new Array(500).fill(500).map(mapfn)
Array.from({ length: 500 }, mapfn)
[Array(500)].map(mapfn)