Skip to content

Conversation

@carl-mastrangelo
Copy link
Contributor

Fixes: #3857

Copy link
Member

@ejona86 ejona86 left a 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()) {
Copy link
Member

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.

Copy link
Contributor Author

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

Copy link
Member

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

@carl-mastrangelo
Copy link
Contributor Author

Identity hashmap is slightly faster. Equals is an uncommon operation, while get and put are common.

@ejona86
Copy link
Member

ejona86 commented Dec 11, 2017

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.

@carl-mastrangelo
Copy link
Contributor Author

jenkins retest this please

@carl-mastrangelo carl-mastrangelo merged commit 1bb9498 into grpc:master Dec 12, 2017
@carl-mastrangelo carl-mastrangelo deleted the hamburcles branch December 12, 2017 02:12
@carl-mastrangelo carl-mastrangelo added this to the 1.9 milestone Dec 12, 2017
@lock lock bot locked as resolved and limited conversation to collaborators Jan 19, 2019
@carl-mastrangelo carl-mastrangelo restored the hamburcles branch August 17, 2019 01:12
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants