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 |
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);