Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
unshift vs concat vs spread vs unshift.apply of another array
(version: 0)
unshift vs concat vs spread of another array
Comparing performance of:
unshift an array vs concat an array vs spread on array vs unshift.apply
Created:
3 years ago
by:
Registered User
Jump to the latest result
Script Preparation code:
var arr1 = []; for (let i=0; i<100; ++i) arr1.push(i); var arr2 = []; for (let i=0; i<100; ++i) arr2.push(i);
Tests:
unshift an array
arr1.unshift(...arr2)
concat an array
arr1.concat(arr2)
spread on array
let arr3 = [...arr1, ...arr2]
unshift.apply
arr1.unshift.apply(arr1, arr2);
Rendered benchmark preparation results:
Suite status:
<idle, ready to run>
Run tests (4)
Previous results
Fork
Test case name
Result
unshift an array
concat an array
spread on array
unshift.apply
Fastest:
N/A
Slowest:
N/A
Latest run results:
No previous run results
This benchmark does not have any results yet. Be the first one
to run it!
Related benchmarks:
Concat vs Prototype Push vs Push Spread
Concat vs Prototype Push vs Push Spread vs Spread
Array concat vs spread operator vs push (es6)
Large Array: concat vs spread vs push
spread vs concat vs unshift(clone)
Comments
Confirm delete:
Do you really want to delete benchmark?