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
Go 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
Push
63.2M/s
Array.prototype.concat
15.6M/s
push + flat
7.0M/s
View exact numbers
Test name
Executions per second
✓
Push
63,151,548 Ops/sec
Array.prototype.concat
15,614,879 Ops/sec
push + flat
7,002,353 Ops/sec
Related benchmarks
concat two arrays: push vs destructuring
Comments
Confirm delete:
Do you really want to delete benchmark?