Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Array concat vs spread operator vs push more elements
(version: 0)
Compare the new ES6 spread operator with the traditional concat() method and push
Comparing performance of:
Array.prototype.concat vs spread operator vs Push
Created:
4 years ago
by:
Guest
Jump to the latest result
Tests:
Array.prototype.concat
var params = [ "hello", true, 7, { some: 123, other: "hi" }, { some: 123, other: "hi" }, { some: 123, other: "hi" }, { some: 123, other: "hi" }, { some: 123, other: "hi" }, { some: 123, other: "hi" }, { some: 123, other: "hi" }, { some: 123, other: "hi" }, { some: 123, other: "hi" }, { some: 123, other: "hi" }, { some: 123, other: "hi" }, { some: 123, other: "hi" }, { some: 123, other: "hi" }, { some: 123, other: "hi" }, { some: 123, other: "hi" }, { some: 123, other: "hi" }, { some: 123, other: "hi" }, { some: 123, other: "hi" }, { some: 123, other: "hi" }, { some: 123, other: "hi" }, { some: 123, other: "hi" }, { some: 123, other: "hi" }, { some: 123, other: "hi" }, { some: 123, other: "hi" }, { some: 123, other: "hi" }, { some: 123, other: "hi" }, { some: 123, other: "hi" }, { some: 123, other: "hi" }, { some: 123, other: "hi" } ]; var other = [ 1, 2, { some: 123, other: "hi" }, { some: 123, other: "hi" }, { some: 123, other: "hi" }, { some: 123, other: "hi" }, { some: 123, other: "hi" }, { some: 123, other: "hi" }, { some: 123, other: "hi" }, { some: 123, other: "hi" } ].concat(params);
spread operator
var params = [ "hello", true, 7, { some: 123, other: "hi" }, { some: 123, other: "hi" }, { some: 123, other: "hi" }, { some: 123, other: "hi" }, { some: 123, other: "hi" }, { some: 123, other: "hi" }, { some: 123, other: "hi" }, { some: 123, other: "hi" }, { some: 123, other: "hi" }, { some: 123, other: "hi" }, { some: 123, other: "hi" }, { some: 123, other: "hi" }, { some: 123, other: "hi" }, { some: 123, other: "hi" }, { some: 123, other: "hi" }, { some: 123, other: "hi" }, { some: 123, other: "hi" }, { some: 123, other: "hi" }, { some: 123, other: "hi" }, { some: 123, other: "hi" }, { some: 123, other: "hi" }, { some: 123, other: "hi" }, { some: 123, other: "hi" }, { some: 123, other: "hi" }, { some: 123, other: "hi" }, { some: 123, other: "hi" }, { some: 123, other: "hi" }, { some: 123, other: "hi" }, { some: 123, other: "hi" } ]; var other = [ 1, 2, { some: 123, other: "hi" }, { some: 123, other: "hi" }, { some: 123, other: "hi" }, { some: 123, other: "hi" }, { some: 123, other: "hi" }, { some: 123, other: "hi" }, { some: 123, other: "hi" }, { some: 123, other: "hi" }, ...params ]
Push
var params = [ "hello", true, 7, { some: 123, other: "hi" }, { some: 123, other: "hi" }, { some: 123, other: "hi" }, { some: 123, other: "hi" }, { some: 123, other: "hi" }, { some: 123, other: "hi" }, { some: 123, other: "hi" }, { some: 123, other: "hi" }, { some: 123, other: "hi" }, { some: 123, other: "hi" }, { some: 123, other: "hi" }, { some: 123, other: "hi" }, { some: 123, other: "hi" }, { some: 123, other: "hi" }, { some: 123, other: "hi" }, { some: 123, other: "hi" }, { some: 123, other: "hi" }, { some: 123, other: "hi" }, { some: 123, other: "hi" }, { some: 123, other: "hi" }, { some: 123, other: "hi" }, { some: 123, other: "hi" }, { some: 123, other: "hi" }, { some: 123, other: "hi" }, { some: 123, other: "hi" }, { some: 123, other: "hi" }, { some: 123, other: "hi" }, { some: 123, other: "hi" }, { some: 123, other: "hi" } ]; var other = [ 1, 2, { some: 123, other: "hi" }, { some: 123, other: "hi" }, { some: 123, other: "hi" }, { some: 123, other: "hi" }, { some: 123, other: "hi" }, { some: 123, other: "hi" }, { some: 123, other: "hi" }, { some: 123, other: "hi" } ].push(...params);
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
Push
Fastest:
N/A
Slowest:
N/A
Latest run results:
No previous run results
This benchmark does not have any results yet. Be the first one
to run it!
Autogenerated LLM Summary
(model
llama3.2:3b
, generated one year ago):
I'm ready to help! It seems like you're sharing benchmark results and test cases for some JavaScript benchmarks, but I don't see a specific question or problem you'd like me to solve. If you could provide more context or clarify what you need help with, I'll do my best to assist you. Are you looking for an explanation of the benchmark results, help with optimizing your code for better performance, or something else?
Related benchmarks:
Array.prototype.concat vs spread operator
concat 2 arrays: Array.prototype.concat vs spread operator
Array concat vs spread operator vs push #3
Array.prototype.concat vs spread operator real
Array.prototype.concat vs spread operator on large array
Comments
Confirm delete:
Do you really want to delete benchmark?