Toggle navigation
MeasureThat
.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Array = Array.concat(Array) vs Array.push(...Array)
(version: 1)
Compares array concatenation via the classic "concat" method and the "push" with a spread operator.
Comparing performance of:
Array.Concat(Array) vs Array.push(...Array)
Created:
one year ago
by:
Guest
Go to the latest result
Script Preparation code:
let baseArray = [1, 2, 3, 4]; const newNeighbors = [5, 6, 7, 8, 9, 0];
Tests:
Array.Concat(Array)
baseArray = baseArray.concat(newNeighbors);
Array.push(...Array)
baseArray.push(...newNeighbors);
Rendered benchmark preparation results:
Suite status:
<idle, ready to run>
Run tests (2)
Previous results
Fork
Test case name
Result
Array.Concat(Array)
Array.push(...Array)
Fastest:
N/A
Slowest:
N/A
Latest run results:
Run details:
(Test run date:
one year ago
)
User agent:
Mozilla/5.0 (X11; Linux x86_64; rv:133.0) Gecko/20100101 Firefox/133.0
Browser/OS:
Firefox 133 on Linux
View result in a separate tab
Embed
Embed Benchmark Result
Array.push(...Array)
3.8M/s
Array.Concat(Array)
2K/s
View exact numbers
Test name
Executions per second
✓
Array.push(...Array)
3,830,931 Ops/sec
Array.Concat(Array)
2,104 Ops/sec
Related benchmarks
Array concat vs spread operator vs push with large arrays
Array concat vs Array.push.apply
Comments
Confirm delete:
Do you really want to delete benchmark?