Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Run results for:
returns unique values in array
Go to the benchmark
Embed
Embed Benchmark Result
Run details:
User agent:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/138.0.0.0 Safari/537.36 Edg/138.0.0.0
Browser:
Chrome 138
Operating system:
Mac OS X 10.15.7
Device Platform:
Desktop
Date tested:
10 months ago
Test name
Executions per second
_.uniq
24933264.0 Ops/sec
set
9993383.0 Ops/sec
uniq by filter
16750088.0 Ops/sec
Array.from with set
9964686.0 Ops/sec
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 elements = [1,2,3,1,2,4,2,3,5,3]
Tests:
_.uniq
_.uniq(elements)
set
[...new Set(elements)]
uniq by filter
elements.filter((v, i, a) => a.indexOf(v) === i)
Array.from with set
Array.from(new Set(elements))