Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
unique elements in array using filter with 20000 items
(version: 0)
Comparing performance of:
_.uniq vs set vs uniq by filter
Created:
5 years ago
by:
Guest
Jump to the latest result
HTML Preparation code:
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/lodash.js/4.17.11/lodash.js"></script>
Script Preparation code:
var firstEqual = []; var secondEqual = []; for (var i=0; i<=10000; i++) { firstEqual.push(i); secondEqual.push(i); } var elements = [...firstEqual, ...secondEqual];
Tests:
_.uniq
_.uniq(elements)
set
[...new Set(elements)]
uniq by filter
elements.filter((v, i, a) => a.indexOf(v) === i)
Rendered benchmark preparation results:
Suite status:
<idle, ready to run>
Run tests (3)
Previous results
Fork
Test case name
Result
_.uniq
set
uniq by filter
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.prototype.filter vs Lodash filter 1Million
Array.prototype.filter vs Lodash filter Clone Test
Array.prototype.filter vs Lodash filter bumped to million
Array.prototype.filter vs Lodash filter bumped to 10k
Array.prototype.filter vs Lodash filter for ~10000
Comments
Confirm delete:
Do you really want to delete benchmark?