Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Lodash "unionBy"vs "uniqBy"
(version: 0)
Comparing performance of:
unionBy vs uniqBy
Created:
3 years ago
by:
Guest
Jump to the latest result
HTML Preparation code:
<script src='https://cdn.jsdelivr.net/npm/lodash@4.17.10/lodash.min.js'></script>
Script Preparation code:
var users = [ { 'name': 'barney', 'age': 36 }, { 'name': 'pebbles', 'age': 5 } ]; var newUsers = [ { 'name': 'fred', 'age': 40 }, { 'name': 'barney', 'age': 36 }, { 'name': 'pebbles', 'age': 2 } ]; for(let i = 0; i < 2000; i++) { var newUser = { 'name': 'user_' + i, 'age': Math.floor(Math.random() * i) }; newUsers.push(newUser); } for(let i = 0; i < 2000; i++) { var newUser = { 'name': 'user_' + i, 'age': Math.floor(Math.random() * i) }; users.push(newUser); }
Tests:
unionBy
const unionUsers2 = _.unionBy(newUsers, users, 'age');
uniqBy
const unionUsers1 = _.uniqBy(newUsers.concat(users), 'age');
Rendered benchmark preparation results:
Suite status:
<idle, ready to run>
Run tests (2)
Previous results
Fork
Test case name
Result
unionBy
uniqBy
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/131.0.0.0 Safari/537.36
Browser/OS:
Chrome 131 on Mac OS X 10.15.7
View result in a separate tab
Embed
Embed Benchmark Result
Test name
Executions per second
unionBy
12448.4 Ops/sec
uniqBy
13591.5 Ops/sec
Related benchmarks:
Lodash "unionWith" "unionBy" "uniqWith"4
Lodash "unionWith" "unionBy" "uniqWith" 5
Lodash "unionWith" "unionBy" "uniqBy" 5
Lodash "uniqWith" "unionBy" "uniqBy" 8
Comments
Confirm delete:
Do you really want to delete benchmark?