Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Lodash difference vs Set
(version: 1)
Comparing performance of:
Lodash vs Set
Created:
one year ago
by:
Guest
Jump to the latest result
HTML Preparation code:
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/lodash@4.17.10/lodash.min.js"></script>
Script Preparation code:
const currentSubscriberIds = ['user1', 'user2', 'user3', 'user4', 'user5']; const newSubscriberIds = ['user3', 'user4', 'user5', 'user6', 'user7'];
Tests:
Lodash
const subscribersToAdd = _.difference(newSubscriberIds, currentSubscriberIds); const subscribersToRemove = _.difference(currentSubscriberIds, newSubscriberIds);
Set
const currentSubscribersSet = new Set(currentSubscriberIds); const newSubscribersSet = new Set(newSubscriberIds); const subscribersToAddSet = [...new Set(newSubscriberIds)] .filter(id => !currentSubscribersSet.has(id)); // ['user6', 'user7'] const subscribersToRemoveSet = [...currentSubscribersSet] .filter(id => !newSubscribersSet.has(id)); // ['user1', 'user2']
Rendered benchmark preparation results:
Suite status:
<idle, ready to run>
Run tests (2)
Previous results
Fork
Test case name
Result
Lodash
Set
Fastest:
N/A
Slowest:
N/A
Latest run results:
Run details:
(Test run date:
10 months ago
)
User agent:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:140.0) Gecko/20100101 Firefox/140.0
Browser/OS:
Firefox 140 on Mac OS X 10.15
View result in a separate tab
Embed
Embed Benchmark Result
Test name
Executions per second
Lodash
5024505.0 Ops/sec
Set
2964896.2 Ops/sec
Related benchmarks:
Lodash Uniq vs Javascript Set
lodash uniq vs set2
includes vs lodash
ES6 spread vs. lodash assign
Lodash vs Vanilla JS Test
lodash vs vanila
lodash (split + join) vs lodash (replace) vs Vanilla JS (split + join) vs Vanilla JS (replace)
JavaScript spread operator vs Object.assign performance 2000
Lodash isEqual vs native JS === for strings
Comments
Confirm delete:
Do you really want to delete benchmark?