-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
Performance fixes based on hotspot analysis in load tests #11148
Closed
Closed
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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.
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.
Hm, at the moment we don't implement
equals()/hashCode()
for generated bean classes so!contextual.equals(other.contextual)
should be translated to!(contextual == other.contextual)
. In other words, this modification could save onejava.lang.Object.equals(Object)
invocation (which is very likely negligible although it removes the equals method from the hot path).Long.toHexString()
saves probably a lot more becauseString.format()
creates a formatter object, parses the string, etc.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.
@mkouba what's you're saying is we should drop the equals() call altogether?
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.
Nope. I'd like to keep it. The fact that we don't implement it now does not mean we'll never need to implement it.
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.
OK. But if it ended up being a hot spot for Paul, there's something weird going on.
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.
It's hard to say without the app and test sources. CC @bcluap
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.
So, I just saw that the profiler used is the one from VisualVM, it inject some bytecode and can generates deoptimization.
That's why it can misleading you to such kind of hotspot.
When working on lowlevel optimizations (and avoiding a method call is very low level), you should use low level stuff like async-profiler, we have a page that expalain how to use it: https://github.com/quarkusio/quarkus/blob/master/TROUBLESHOOTING.md
So again, the hotspot for the equals method call is certainly a profiler artefact not a real hotspot.
And 1% difference between two load testing run is very slight so can go into the recording error range.
Such small performance enhancements should be validated via microbenchmarking using JMH ...
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.
Yes, we talked about this in the comments below, e.g. #11148 (comment).
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.
If you have many possible concrete types implementing
Contextual
, the dispatch to find the rightequals
implementation becomes a very expensive megamorphic call.+1 for the shortcut
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.
As mentioned above we removed the need for
equals()
from the hot path completely...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.
Sure that's even better. I just meant to suggest a possible explanation for the equals to be - in some contexts - really not that efficient. Removing the field is even better!