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
Jump 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
Test name
Executions per second
Array.Concat(Array)
2104.1 Ops/sec
Array.push(...Array)
3830931.2 Ops/sec
Related benchmarks:
spread vs concat vs unshift (with slice)
Array concat vs spread operator vs push reassign v2
Array concat vs spread operator vs push (es6)
2unshift vs2 spread vs concat
Array concat vs spread operator vs push fork
Benchmark, spread vs. concat vs. push in Array push item
spread vs concat vs unshift vs aaa
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?