Toggle navigation
MeasureThat
.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Lodash UniqBy vs. Vanilla alternative
(version: 1)
Comparing performance of:
Lodash (_.uniqBy) vs Vanilla code
Created:
one year ago
by:
Guest
Go to the latest result
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; });
Rendered benchmark preparation results:
Suite status:
<idle, ready to run>
Run tests (2)
Previous results
Fork
Test case name
Result
Lodash (_.uniqBy)
Vanilla code
Fastest:
N/A
Slowest:
N/A
Latest run results:
Run details:
(Test run date:
one year ago
)
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/OS:
Chrome 134 on Mac OS X 10.15.7
View result in a separate tab
Embed
Embed Benchmark Result
Lodash (_.uniqBy)
2/s
Vanilla code
1/s
View exact numbers
Test name
Executions per second
✓
Lodash (_.uniqBy)
2 Ops/sec
Vanilla code
1 Ops/sec
Related benchmarks
Lodash uniqBy vs Set 10000
Lodash uniqBy vs Set with Array of object
lodash uniq vs Array.from(new Set()) vs spread new Set() vs for vs for memory optimized 4
lodash uniq vs set my 2
New set vs UniqWith
Lodash uniqBy vs Set with Big array
ETST 123123123123123
Comments
Confirm delete:
Do you really want to delete benchmark?