Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Run results for:
Array concat vs spread operator vs push with two arrays
Compare the new ES6 spread operator with the traditional concat() method and push
Go to the benchmark
Embed
Embed Benchmark Result
Run details:
User agent:
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/123.0.0.0 Safari/537.36
Browser:
Chrome 123
Operating system:
Windows
Device Platform:
Desktop
Date tested:
2 years ago
Test name
Executions per second
Array.prototype.concat
9130439.0 Ops/sec
spread operator twice
25110960.0 Ops/sec
Push
32211366.0 Ops/sec
Tests:
Array.prototype.concat
var arr1 = [ "the", "quick", "brown", "fox", "jumps" ]; var arr2 = [ "over", "the", "lazy", "dog" ]; var other = arr1.concat(arr2);
spread operator twice
var arr1 = [ "the", "quick", "brown", "fox", "jumps" ]; var arr2 = [ "over", "the", "lazy", "dog" ]; var other = [ ...arr1, ...arr2 ];
Push
var arr1 = [ "the", "quick", "brown", "fox", "jumps" ]; var arr2 = [ "over", "the", "lazy", "dog" ]; var other = arr1.push(...arr2);