Test name | Executions per second |
---|---|
concat | 167.3 Ops/sec |
spread push | 1246.2 Ops/sec |
spread | 65.6 Ops/sec |
push single | 8641.9 Ops/sec |
var params = new Array(1000);
let other = [];
for (let x = 0; x < 100; ++x) {
other = other.concat(params);
}
console.log(other);
var params = new Array(1000);
let other = [];
for (let x = 0; x < 100; ++x) {
other.push(params);
}
console.log(other);
var params = new Array(1000);
let other = [];
for (let x = 0; x < 100; ++x) {
other = [other, params];
}
console.log(other);
var params = new Array(1000);
let other = [];
for (let x = 0; x < 100; ++x) {
params.forEach(p => other.push(p));
}
console.log(other);