New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
optimize key librlist functions to improve flux resource list
performance
#5824
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## master #5824 +/- ##
==========================================
+ Coverage 83.35% 83.37% +0.02%
==========================================
Files 509 509
Lines 82494 82528 +34
==========================================
+ Hits 68759 68805 +46
+ Misses 13735 13723 -12
|
Wow great! |
garlick
approved these changes
Mar 24, 2024
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
Thanks! Setting MWP |
Problem: Profiling shows that an inordinate amount of time is spent in util_idset_add_check() when building an rlist object from an R object. This appears to be beacuse both the idset calls in this function; idset_has_intersection() and idset_union(); always traverse all of the idset `b` entries. In the case of building a new rlist, the idset `a` is empty because we are adding new ids to a new rnode, so this traversal is completely unnecessary. In the case that idset `a` is empty, return a copy of `b` and skip calling the other idset calls completely.
Problem: idset_equal() has to iterate all ids in both idsets being compared when the idsets are equal. This is twice the necessary work when the idsets have already been verified to have equal counts. If the counts of the two idsets have already been verified to be equivalent, then iterating the second idset is wasted work. Check for this condition after iterating idset1 and return true immediately.
Problem: Profiling shows the majority of time in rnode_diff() is spent in idset_subtract() because idset_clear() appears to be quite an expensive operation. In the case that two rnodes children are equal, skip idset_subtract() and simply make the target rnode child empty using a new rnode_child_clear() function. Since idset_clear() is expensive, recreate the child idsets instead of trying to clear all ids.
This was referenced Mar 25, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR fixes some key hotspots in librlist and libidset found while profiling poor
flux resource list
performance.This is based on #5823 just to show the cumulative performance gains.
On #5823:
On this PR branch: