Test name | Executions per second |
---|---|
concat | 99.1 Ops/sec |
spread push | 893.7 Ops/sec |
spread | 35.2 Ops/sec |
push single | 8044.0 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);