Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Run results for:
Array concat vs spread vs unshift
Compare the new ES6 spread operator with the traditional concat() method and unshift
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/121.0.0.0 Safari/537.36
Browser:
Chrome 121
Operating system:
Windows
Device Platform:
Desktop
Date tested:
2 years ago
Test name
Executions per second
Concat
2461570.5 Ops/sec
Spread
9353793.0 Ops/sec
Unshift each
2749104.2 Ops/sec
Unshift together
3475182.5 Ops/sec
Tests:
Concat
var params = [ "hello", true, 7 ]; var other = [ 1, 2 ].concat(params);
Spread
var params = [ "hello", true, 7 ] var other = [ 1, 2, ...params ]
Unshift each
var params = [ "hello", true, 7 ]; params.unshift(2); params.unshift(1);
Unshift together
var params = [ "hello", true, 7 ]; params.unshift(1, 2);