Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Run results for:
Lodash UniqBy vs. Vanilla alternative
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/134.0.0.0 Safari/537.36
Browser:
Chrome 134
Operating system:
Mac OS X 10.15.7
Device Platform:
Desktop
Date tested:
one year ago
Test name
Executions per second
Lodash (_.uniqBy)
2.4 Ops/sec
Vanilla code
0.8 Ops/sec
HTML Preparation code:
<script src="https://cdn.jsdelivr.net/npm/lodash@4.17.4/lodash.min.js"></script>
Script Preparation code:
const max2 = 10000000; // 10,000,000 (10 Million) const arr2 = Array.from({ length: 10000000 }, (_, i) => Math.random() >= 0.5 ? ({ id: i }) : ({ id: Math.floor(Math.random() * 10) + 1 }))
Tests:
Lodash (_.uniqBy)
_.uniqBy(arr2, (el) => el.id)
Vanilla code
const idsAlreadySeen = new Set(); const uniqArr = arr2.filter(data => { if (idsAlreadySeen.has(data.id)) { return false; } idsAlreadySeen.add(data.id); return true; });