Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Array concat vs spread operator vs push with two arrays
(version: 0)
Compare the new ES6 spread operator with the traditional concat() method and push
Comparing performance of:
Array.prototype.concat vs spread operator twice vs Push
Created:
6 years ago
by:
Guest
Jump to the latest result
Tests:
Array.prototype.concat
var arr1 = [ "the", "quick", "brown", "fox", "jumps" ]; var arr2 = [ "over", "the", "lazy", "dog" ]; var other = arr1.concat(arr2);
spread operator twice
var arr1 = [ "the", "quick", "brown", "fox", "jumps" ]; var arr2 = [ "over", "the", "lazy", "dog" ]; var other = [ ...arr1, ...arr2 ];
Push
var arr1 = [ "the", "quick", "brown", "fox", "jumps" ]; var arr2 = [ "over", "the", "lazy", "dog" ]; var other = arr1.push(...arr2);
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 twice
Push
Fastest:
N/A
Slowest:
N/A
Latest run results:
Run details:
(Test run date:
2 years ago
)
User agent:
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/123.0.0.0 Safari/537.36
Browser/OS:
Chrome 123 on Windows
View result in a separate tab
Embed
Embed Benchmark Result
Test name
Executions per second
Array.prototype.concat
9130439.0 Ops/sec
spread operator twice
25110960.0 Ops/sec
Push
32211366.0 Ops/sec
Related benchmarks:
Array.prototype.concat vs spread operator
concat 2 arrays: Array.prototype.concat vs spread operator
Concat vs Spread (Two Arrays)
Array concat vs spread operator vs push with more data
Array.prototype.concat vs spread operator real
Comments
Confirm delete:
Do you really want to delete benchmark?