-
Notifications
You must be signed in to change notification settings - Fork 214
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 message filters to reduce CPU load #885
Merged
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
In the profiling with jvisualvm this reduces the total time for MessageFilter::match from 5x the self-time to about 1.2x the self-time In profiling with instrumentation, MessageFilter::match is the most expensive method call, because it is called millions of times in a tight inner loop while handling messages.
Match is called so often, that the match-method with two arguments took 20% of the self-time of the match-method with three arguments. This may be inflated due to the instrumentation, though, because the method with two arguments does nothing except for running the method with three arguments with the default (false), so I expect less than those 20% in wins.
To evaluate the logs this produces: grep -Eo or-match.* ~/Freenet/logs/freenet-latest.log | \ sort | uniq -c | sort -h \ > misordered-MessageFilter-or-matches.log cat misordered-MessageFilter-or-matches.log this produces a list of MessageFilters with the frequency for pairs where the first is the one that did not match and the second is the filter that did match.
Bombe
requested changes
Jan 28, 2024
…ng code." This reverts commit eaed0f3.
I removed the TODOs again (reverted the commit adding them). These were just notes to myself, but I am not likely to get to them in the next few weeks, so they actually serve no purpose. When I get into that part of the code again at another time, I’ll see how to improve it. Thank you for reminding me! |
7e57e79
to
d1eeb8c
Compare
d1eeb8c
to
d06857d
Compare
Bombe
approved these changes
Jan 30, 2024
Merged — thank you very much for your review! |
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.
In profiling with instrumentation, this reduces the cost for MessageFilter::match by factor 4. It might reduce the total CPU needs of fred by factor 2.