Toggle navigation
MeasureThat
.net
Create a benchmark
Tools
Feedback
Feature Requests
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 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/131.0.0.0 Safari/537.36
Browser:
Chrome 131
Operating system:
Windows
Device Platform:
Desktop
Date tested:
one year ago
Benchmark engine:
Benchmark.js
_.uniq
12.1M/s
uniq by filter
9.3M/s
set
5.7M/s
Array.from with set
5.6M/s
View exact numbers
Test name
Executions per second
✓
_.uniq
12,069,238 Ops/sec
uniq by filter
9,305,067 Ops/sec
set
5,719,851 Ops/sec
Array.from with set
5,550,396 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))