Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Run results for:
Array.prototype.concat vs spread operator (large, small diff
Compare the new ES6 spread operator with the traditional concat() method
Go to the benchmark
Embed
Embed Benchmark Result
Run details:
User agent:
Mozilla/5.0 (Linux; Android 10; K) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/128.0.0.0 Mobile Safari/537.36
Browser:
Chrome Mobile 128
Operating system:
Android
Device Platform:
Mobile
Date tested:
one year ago
Test name
Executions per second
Array.prototype.concat small
3713005.8 Ops/sec
spread operator (small)
6207353.5 Ops/sec
Array.prototype.concat (large)
378036.7 Ops/sec
spread operator (large)
73231.6 Ops/sec
Script Preparation code:
// preparation var a = Array.from({length: 1000}).map((_, i)=>`${i}`); var b = Array.from({length: 2000}).map((_, i)=>`${i}`); var aSmall = ['a', 'b', 'c', 'd']; var bSmall = ['e', 'f', 'g', 'h', 'i'];
Tests:
Array.prototype.concat small
aSmall.concat(bSmall);
spread operator (small)
[...aSmall, ...bSmall]
Array.prototype.concat (large)
a.concat(b);
spread operator (large)
[...a, ...b]