Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Adding an element to array: concat vs spread vs push
(version: 0)
Comparing performance of:
Array.prototype.concat vs spread operator vs Push
Created:
one year ago
by:
Guest
Jump to the latest result
Script Preparation code:
var el = 3; var arr = [ 1, 2 ];
Tests:
Array.prototype.concat
var other = arr.concat(el);
spread operator
var other = [...arr, el]
Push
var other = arr.push(el);
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/129.0.0.0 Safari/537.36
Browser/OS:
Chrome 129 on Mac OS X 10.15.7
View result in a separate tab
Embed
Embed Benchmark Result
Test name
Executions per second
Array.prototype.concat
6257504.0 Ops/sec
spread operator
11808893.0 Ops/sec
Push
12828865.0 Ops/sec
Related benchmarks:
Array spread vs. push performance
Array push vs spread vs concat
Array concat vs spread operator vs push - single element
Array concat vs spread operator vs push with single element
Array push vs spread vs concat large
Array concat vs spread operator vs push mine
Array concat vs spread operator vs push for single values
Comments
Confirm delete:
Do you really want to delete benchmark?