Run details:
Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:58.0) Gecko/20100101 Firefox/58.0
Firefox 58
Ubuntu
Other
2025 years ago
Test name Executions per second
spread 892461.6 Ops/sec
p-push 948853.7 Ops/sec
for of 738591.8 Ops/sec
Script Preparation code:
x
 
var a = [1,1,1,1,23,,5,6,3,2132,,66,456,,546];
var s = []
Tests:
  • spread

     
    s.push(...a);
  • p-push

     
    Array.prototype.push.apply(s, a);
  • for of

     
    for (const item of a) {
     s.push(item);
    }