Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
remove duplicates from array
(version: 0)
Comparing performance of:
a vs b vs c
Created:
3 years ago
by:
Guest
Jump to the latest result
Tests:
a
let a=[1,1,2,2,3,3,4,4,5,5] function uniq_fast(a) { var seen = {}; var out = []; var len = a.length; var j = 0; for(var i = 0; i < len; i++) { var item = a[i]; if(seen[item] !== 1) { seen[item] = 1; out[j++] = item; } } return out; } console.log(uniq_fast(a));
b
let a=[1,1,2,2,3,3,4,4,5,5] function uniq(a) { return Array.from(new Set(a)); } console.log(uniq(a));
c
let a=[1,1,2,2,3,3,4,4,5,5] let uniq = a => [...new Set(a)]; console.log(uniq(a));
Rendered benchmark preparation results:
Suite status:
<idle, ready to run>
Run tests (3)
Previous results
Fork
Test case name
Result
a
b
c
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:
Array duplicate removal for duplicates exceeding `N`-number
Array duplicate removal for duplicates exceeding `N`-number
Array duplicate removal for duplicates exceeding `N`-number
Array duplicate removal for duplicates exceeding `N`-number
Methods to remove duplicates from array (fork)
Comments
Confirm delete:
Do you really want to delete benchmark?