Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Сreate a copy of an array by reference
(version: 0)
Comparing performance of:
Concat Array to empty vs Concat empty to Array vs Spread vs Slice vs Splice
Created:
2 years ago
by:
Guest
Jump to the latest result
Script Preparation code:
const arr = Array.from({length: 1000}, () => Math.floor(Math.random() * 4000));
Tests:
Concat Array to empty
const result = [].concat(arr);
Concat empty to Array
const result = arr.concat([]);
Spread
const result = [...arr]
Slice
const result = arr.slice()
Splice
const result = myArray.splice(0)
Rendered benchmark preparation results:
Suite status:
<idle, ready to run>
Run tests (5)
Previous results
Fork
Test case name
Result
Concat Array to empty
Concat empty to Array
Spread
Slice
Splice
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!
Comments
Confirm delete:
Do you really want to delete benchmark?