Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
concat vs spread operator vs apply vs constructor
(version: 0)
Compare the new ES6 spread operator with the traditional concat() method and apply
Comparing performance of:
Array.prototype.concat vs spread operator vs apply proto vs params.push vs constructor
Created:
5 years ago
by:
Guest
Jump to the latest result
Script Preparation code:
var constructor = Function.prototype.apply.bind(Array.prototype.constructor, null);
Tests:
Array.prototype.concat
var params = [ "hello", true, 7 ]; var other = [ 1, 2 ].concat(params);
spread operator
var params = [ "hello", true, 7 ]; var other = params.push(...[1, 2]);
apply proto
var params = [ "hello", true, 7 ]; Array.prototype.push.apply(params, [1, 2]);
params.push
var params = [ "hello", true, 7 ]; var other = params.push.apply(params, [1, 2]);
constructor
var params = [ "hello", true, 7 ]; var other = constructor(params);
Rendered benchmark preparation results:
Suite status:
<idle, ready to run>
Run tests (5)
Previous results
Fork
Test case name
Result
Array.prototype.concat
spread operator
apply proto
params.push
constructor
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!
Related benchmarks:
concat 2 arrays: Array.prototype.concat vs spread operator
Array.prototype.concat vs spread operator (add)
Array.prototype.concat vs spread operator (fix)
Array.prototype.concat vs spread operator on large array
Array.prototype.concat vs spread operator on small array
Comments
Confirm delete:
Do you really want to delete benchmark?