Run details:
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/95.0.4638.54 Safari/537.36 Edg/95.0.1020.40
Chrome 95
Windows
Desktop
3 years ago
Test name Executions per second
concat 99.2 Ops/sec
spread push 953.9 Ops/sec
spread 33.0 Ops/sec
push single 5199.7 Ops/sec
Tests:
  • concat

    x
     
    var params = new Array(1000);
    let other = [];
    for (let x = 0; x < 100; ++x) {
      other = other.concat(params);
    }
    console.log(other);
  • spread push

     
    var params = new Array(1000);
    let other = [];
    for (let x = 0; x < 100; ++x) {
      other.push(...params);
    }
    console.log(other);
  • spread

     
    var params = new Array(1000);
    let other = [];
    for (let x = 0; x < 100; ++x) {
      other = [...other, ...params];
    }
    console.log(other);
  • push single

     
    var params = new Array(1000);
    let other = [];
    for (let x = 0; x < 100; ++x) {
      params.forEach(p => other.push(p));
    }
    console.log(other);