Toggle navigation
MeasureThat
.net
Create a benchmark
Tools
Feedback
Feature Requests
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
Benchmark engine:
Benchmark.js
Spread
9.4M/s
Unshift together
3.5M/s
Unshift each
2.7M/s
Concat
2.5M/s
View exact numbers
Test name
Executions per second
✓
Spread
9,353,793 Ops/sec
Unshift together
3,475,182 Ops/sec
Unshift each
2,749,104 Ops/sec
Concat
2,461,570 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);