Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Run results for:
Lodash uniq vs Object unique keys vs Set
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/134.0.0.0 Safari/537.36 Edg/134.0.0.0
Browser:
Chrome 134
Operating system:
Windows
Device Platform:
Desktop
Date tested:
one year ago
Test name
Executions per second
Lodash uniq
8611383.0 Ops/sec
Object unique key
3700634.8 Ops/sec
Set
6118188.5 Ops/sec
HTML Preparation code:
<script src='https://cdnjs.cloudflare.com/ajax/libs/lodash.js/4.17.5/lodash.min.js'></script>
Script Preparation code:
var arr = ['Jane', 'Bob', 'Kat', 'Kat', 'Bob', 'Jane', 'Ian', 'Jane', 'Bob', 'Kat', 'Kat', 'Bob', 'Jane', 'Ian']; Array.prototype.uniqueString = function() { let tmpObj = {} for (var i = 0; i < this.length; i++) { tmpObj[this[i]] = this[i] } return Object.values(tmpObj) }
Tests:
Lodash uniq
_.uniq(arr);
Object unique key
arr.uniqueString();
Set
new Set(arr)