-
Notifications
You must be signed in to change notification settings - Fork 1.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
Make Message.hashCode Consistent with Message.equals #941
Make Message.hashCode Consistent with Message.equals #941
Conversation
@@ -28,6 +26,8 @@ | |||
import java.io.Serializable; | |||
import java.util.List; | |||
|
|||
import static com.google.common.base.Preconditions.checkNotNull; |
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.
Why'd you move this?
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.
Inadvertent (IntelliJ defaults). I will fix 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.
Fixed in d20bf5b
Have you measured the performance effect of this? |
@tavianator - yes, for the case I was describing above. Inserting single The actual implementation of Are there other specific benchmark cases you think it would make sense for me to measure? Happy to post results for those as well. Will try to put something together by the weekend (I don't have much time for it during the work week). |
I tested out two things related to performance. For the sake of being thorough I just timed the The second thing I did was time a simpler version of what was happening in the production codebase where I saw the original issue: each time a new
The red line below is the timings with the old implementation, the blue line with the new. The timing code is pretty trivial: just a run to get rid of JIT overhead and then a loop to measure the hash code time or to build sets of a certain size.. These message counts are large for any normal use case, but going back to the original issue: when stuck in an infinite cycle of exceptions during dependency resolution in a production situation, this made understanding the current state of an application difficult since the application was spending the majority of its time inserting Happy to look at specific cases where this change might be considered risky. Other than the runaway exception case I mentioned, I'm having trouble finding one where |
…stency Make Message.hashCode Consistent with Message.equals
Fixes #940
This commit makes
Message.hashCode
andMessage.equals
computed off of the same fields.