-
Notifications
You must be signed in to change notification settings - Fork 895
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
Reduce unnecessary loop in removeIf if map is empty #3512
Merged
StevenLuMT
merged 1 commit into
apache:master
from
Shawyeok:reduce-unnecessary-predication-loop
Oct 8, 2022
Merged
Reduce unnecessary loop in removeIf if map is empty #3512
StevenLuMT
merged 1 commit into
apache:master
from
Shawyeok:reduce-unnecessary-predication-loop
Oct 8, 2022
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
StevenLuMT
approved these changes
Oct 3, 2022
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
rerun failure checks |
eolivelli
approved these changes
Oct 4, 2022
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
shoothzj
approved these changes
Oct 4, 2022
zymap
approved these changes
Oct 8, 2022
zymap
pushed a commit
that referenced
this pull request
Oct 26, 2022
Reduce unnecessary loop in removeIf if section is empty (cherry picked from commit bc87bfb)
hangc0276
pushed a commit
to hangc0276/bookkeeper
that referenced
this pull request
Nov 7, 2022
Reduce unnecessary loop in removeIf if section is empty (cherry picked from commit bc87bfb)
hangc0276
pushed a commit
to hangc0276/bookkeeper
that referenced
this pull request
Nov 7, 2022
Reduce unnecessary loop in removeIf if section is empty (cherry picked from commit bc87bfb)
Ghatage
pushed a commit
to sijie/bookkeeper
that referenced
this pull request
Jul 12, 2024
Reduce unnecessary loop in removeIf if section is empty
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
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.
Motivation
After unload all bundles of a heavy pulsar broker, cpu usage is still above 50%, here is a cpu profile and a heapdump
![image](https://user-images.githubusercontent.com/5058708/193253189-1cfd66d4-11ab-4850-9768-eeb113ba0ce1.png)
![image](https://user-images.githubusercontent.com/5058708/193262269-d68f5268-f256-4fc7-9f0d-a2c6321ee2c6.png)
It looks like there's a schedule task executing
BookieClientImpl#monitorPendingOperations
.Most of
completionObjects
inPerChannelBookieClient
are empty.IMO, it's worth to check whether a section is empty or not in loop predication.
Changes
Add
size > 0
intoSection#removeIf
loop predication.