[cleaner] Break loop over compiled_regexes in case of no match#4267
Merged
pmoravec merged 1 commit intososreport:mainfrom Apr 10, 2026
Merged
Conversation
A heuristic improving performance by several additional percents. Since a line usually contains at most a few matches only, it pays off to search again for one compiled_search rather than tens/hundreds of individual compiled_regexes searches. Closes: sosreport#4267 Relevant: sosreport#4227 Signed-off-by: Pavel Moravec <pmoravec@redhat.com>
65fb0b6 to
4481464
Compare
|
Congratulations! One of the builds has completed. 🍾 You can install the built RPMs by following these steps:
Please note that the RPMs should be used only in a testing environment. |
Contributor
Author
|
Kindly asking @TurboTurtle and/or @arif-ali for a review. |
jcastill
reviewed
Apr 9, 2026
| count += _count | ||
| # break the cycle if no further search can apply | ||
| if not self.mapping.compiled_search.search(line): | ||
| break |
Member
There was a problem hiding this comment.
Do you think it would be worth adding some logging here? Perhaps at debug level, so it's not printed every time. The idea is that we avoid situations where we silently break the cycle and then we need to investigate an issue where that shouldn't have happened
This file contains hidden or 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
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.
A heuristic improving performance by several additional percents. Since a line usually contains at most a few matches only, it pays off to search again for one compiled_search rather than tens/hundreds of individual compiled_regexes searches.
Closes: #4267
Relevant: #4227
Please place an 'X' inside each '[]' to confirm you adhere to our Contributor Guidelines