Toggle navigation
MeasureThat
.net
Create a benchmark
Tools
Feedback
Feature Requests
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; rv:141.0) Gecko/20100101 Firefox/141.0
Browser:
Firefox 141
Operating system:
Linux
Device Platform:
Desktop
Date tested:
one year ago
Benchmark engine:
Benchmark.js
Set
2.1M/s
uniq
1.1M/s
View exact numbers
Test name
Executions per second
✓
Set
2,076,646 Ops/sec
uniq
1,126,943 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;