Run details:
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/69.0.3497.100 Safari/537.36
Chrome 69
Windows
Desktop
6 years ago
Test name Executions per second
Set-length array 836.4 Ops/sec
Array.push 1.1 Ops/sec
Tests:
  • Set-length array

    AخA
     
    let arr = Array(1000).fill(undefined).map(e => Math.floor(Math.random()*1000000+1));
  • Array.push

     
    let arr = [];
    for (i=0; i<1000001; i++){arr.push(Math.floor(Math.random()*1000000+1))}