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
Go 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
Push
12.8M/s
spread operator
11.8M/s
Array.prototype.concat
6.3M/s
View exact numbers
Test name
Executions per second
✓
Push
12,828,865 Ops/sec
spread operator
11,808,893 Ops/sec
Array.prototype.concat
6,257,504 Ops/sec
Related benchmarks
Array spread vs. push performance
Array push vs spread vs concat
Array concat vs spread operator vs push for single values
Comments
Confirm delete:
Do you really want to delete benchmark?