Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Run results for:
spread vs concat vs unshift with slice v2
spread vs concat vs unshift with slice v2
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/127.0.0.0 Safari/537.36
Browser:
Chrome 127
Operating system:
Windows
Device Platform:
Desktop
Date tested:
one year ago
Test name
Executions per second
Concat
1941244.2 Ops/sec
Spread
1468074.6 Ops/sec
Double Spread
1406004.5 Ops/sec
Unshift
3545.8 Ops/sec
Script Preparation code:
var array = [1,2,3,4]; var result = [];
Tests:
Concat
result = array.slice(2).concat(array);
Spread
result = [...array, ...array.slice(2)];
Double Spread
const [first, second, ...others] = array; result = [...array, ...others];
Unshift
result.unshift(...array.slice(2));