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 (X11; Ubuntu; Linux x86_64; rv:129.0) Gecko/20100101 Firefox/129.0
Browser:
Firefox 129
Operating system:
Ubuntu
Device Platform:
Desktop
Date tested:
one year ago
Test name
Executions per second
Concat
24609188.0 Ops/sec
Spread
16057538.0 Ops/sec
Double Spread
11638448.0 Ops/sec
Unshift
333695.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));