Toggle navigation
MeasureThat
.net
Create a benchmark
Tools
Feedback
Feature Requests
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
Benchmark engine:
Benchmark.js
Push
32.2M/s
spread operator twice
25.1M/s
Array.prototype.concat
9.1M/s
View exact numbers
Test name
Executions per second
✓
Push
32,211,366 Ops/sec
spread operator twice
25,110,960 Ops/sec
Array.prototype.concat
9,130,439 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);