Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Array push vs concat vs push + flat to merge to arrays
(version: 1)
Comparing performance of:
Array.prototype.concat vs push + flat vs Push
Created:
one year ago
by:
Guest
Jump to the latest result
Tests:
Array.prototype.concat
let params1 = [ "hello", true, 7 ]; const params2 = [ "hello", true, 7 ]; params1 = params1.concat(params2);
push + flat
let params1 = [ "hello", true, 7 ]; const params2 = [ "hello", true, 7 ]; params1.push(params2) params1 = params1.flat()
Push
let params1 = [ "hello", true, 7 ]; const params2 = [ "hello", true, 7 ]; params1.push(...params2);
Rendered benchmark preparation results:
Suite status:
<idle, ready to run>
Run tests (3)
Previous results
Fork
Test case name
Result
Array.prototype.concat
push + flat
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/131.0.0.0 Safari/537.36
Browser/OS:
Chrome 131 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
15614879.0 Ops/sec
push + flat
7002353.0 Ops/sec
Push
63151548.0 Ops/sec
Related benchmarks:
Ways of adding elements to an array
Array.prototype.concat vs spread vs push 08072019
concat vs spread vs push
Array.push( spread ) vs assign Array.concat()
Array concat vs spread operator vs push new
Array concat, spread, push for one value
Array.concat vs Array.push vs Array.push spread
Array concat vs spread operator vs push vs splice vs for-each push vs for-of push
concat two arrays: push vs destructuring
Comments
Confirm delete:
Do you really want to delete benchmark?