Toggle navigation
MeasureThat
.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Array concat vs spread operator vs push - fork
(version: 1)
Compare the new ES6 spread operator with the traditional concat() method and push
Comparing performance of:
Array.prototype.concat vs spread operator vs Push
Created:
one year ago
by:
Guest
Go to the latest result
Tests:
Array.prototype.concat
var params = [ "hello", true, 72312 ]; var other = params.reduce((acc, curr) => acc.concat(curr), []);
spread operator
var params = [ "hello", true, 7 ] var other = params.reduce((acc, curr) => [...acc, curr], []);
Push
var params = [ "hello", true, 7 ]; var other = params.reduce((acc, curr) => acc.push(curr) && acc, []);
Rendered benchmark preparation results:
Suite status:
<idle, ready to run>
Run tests (3)
Previous results
Fork
Test case name
Result
Array.prototype.concat
spread operator
Push
Fastest:
N/A
Slowest:
N/A
Latest run results:
Run details:
(Test run date:
one year ago
)
User agent:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/132.0.0.0 Safari/537.36
Browser/OS:
Chrome 132 on Mac OS X 10.15.7
View result in a separate tab
Embed
Embed Benchmark Result
Push
90.7M/s
spread operator
21.5M/s
Array.prototype.concat
5.2M/s
View exact numbers
Test name
Executions per second
✓
Push
90,650,160 Ops/sec
spread operator
21,531,456 Ops/sec
Array.prototype.concat
5,240,528 Ops/sec
Related benchmarks
Array concat vs double spread operator vs push
Array concat vs spread operator vs push (via for loop)
Array concat vs spread operator vs push vs prototype.push.apply
Comments
Confirm delete:
Do you really want to delete benchmark?