-
Notifications
You must be signed in to change notification settings - Fork 3.9k
core: fix Attributes value equality #3859
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
Conversation
ejona86
left a 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.
Why don't we just swap away from IdentityHashMap?
| if (data.size() != that.data.size()) { | ||
| return false; | ||
| } | ||
| for (Entry<Key<?>, Object> e : data.entrySet()) { |
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.
This only handles one direction. that.data may contain an extra element, but this would incorrectly say they were equal.
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.
the sizes are checked above
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.
Oh, you're right. kk
|
Identity hashmap is slightly faster. Equals is an uncommon operation, while get and put are common. |
|
While a microbenchmark can possibly notice a minor difference in performance, that level of optimization seems unlikely to matter at all in the greater scheme of things. Instead, it just makes more complicated code and bugs. But whatever. |
|
jenkins retest this please |
Fixes: #3857