Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
(very) short array duplication
(version: 0)
testing 3 item array duplication methods
Comparing performance of:
while loop vs slice vs for loop vs Array.from vs es6 vs concat
Created:
4 years ago
by:
Registered User
Jump to the latest result
Tests:
while loop
a = Array(3); b = Array(3); i = a.length; while(i--) b[i] = a[i];
slice
a = Array(3); b = a.slice(0);
for loop
a = Array(3); b = Array(3); for(var i = 0, len = a.length; i < len; ++i) b[i] = a[i];
Array.from
a = Array(3); b = Array.from(a);
es6
a = Array(3); b = [...a];
concat
a = Array(3); b = [].concat(a)
Rendered benchmark preparation results:
Suite status:
<idle, ready to run>
Run tests (6)
Previous results
Fork
Test case name
Result
while loop
slice
for loop
Array.from
es6
concat
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:
Methods to remove duplicates from array (fork)
Methods to remove duplicates from array (test)
Deduplicate array test
Deduplicate array test v2
Duplicate to unique array time complexity measure w/ different approaches.
Comments
Confirm delete:
Do you really want to delete benchmark?