-
Notifications
You must be signed in to change notification settings - Fork 3.5k
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
Replace orElse with orElseGet to avoid calling too many times. #11542
Replace orElse with orElseGet to avoid calling too many times. #11542
Conversation
1c8f7d6
to
602ea02
Compare
/pulsarbot run-failure-checks |
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
The patch looks good. I am not sure we achieve some visible improvement because in anyway you are allocating an instance of the lambda expression. Probably the overhead of instantiating such instance will be lower. I am +1 |
If the lambda is not capturing any reference, like |
I am not sure if it really happens. |
…e#11542) (apache#11542) (cherry picked from commit 27855f8)
Motivation
Use orElseGet when
orElse(xxx)
is not a raw value, otherwise it will calling the value every time.Documentation
This is an enhancement, no need to update doc.