Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Run results for:
Array of strings, null, and ints lodash uniq vs set
What is the fastest method of getting a the unique items from an array
Go to the benchmark
Embed
Embed Benchmark Result
Run details:
User agent:
Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/138.0.0.0 Safari/537.36
Browser:
Chrome 138
Operating system:
Linux
Device Platform:
Desktop
Date tested:
9 months ago
Test name
Executions per second
Set
2562858.2 Ops/sec
uniq
1917114.2 Ops/sec
HTML Preparation code:
<script src='https://cdn.jsdelivr.net/npm/lodash@4.17.10/lodash.min.js'></script>
Script Preparation code:
var arr = ['Batman', 'Dr. Doom', null, 'Iron Man', 'Rorschach', 'Captain America', 'J. Jonah Jameson', 'The Mekon', null, '', null, '', 'Scott Pilgrim', 'Batman', 'Dr. Doom', 'Iron Man', 'Rorschach', 'Captain America', 'J. Jonah Jameson', 'The Mekon', 'Scott Pilgrim', 1, 2, 3, 4, 5, 6, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7];
Tests:
Set
var u = new Set(arr); return u;
uniq
var u = _.uniq(arr) return u;