Toggle navigation
MeasureThat
.net
Create a benchmark
Tools
Feedback
Feature Requests
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:
2 years ago
Benchmark engine:
Benchmark.js
spread operator (small)
6.2M/s
Array.prototype.concat small
3.7M/s
Array.prototype.concat (large)
378K/s
spread operator (large)
73K/s
View exact numbers
Test name
Executions per second
✓
spread operator (small)
6,207,354 Ops/sec
Array.prototype.concat small
3,713,006 Ops/sec
Array.prototype.concat (large)
378,037 Ops/sec
spread operator (large)
73,232 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]