Include hashes of containing types when computing hash in EEClassHashTable #61652
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.
Prior to this change all nested types with the same name would be placed into the same hash bucket, regardless of their enclosing types. That ensures collisions for common type names like
Enumerator
or<>c
.The approach in this change is similar to what we do in R2R hash - the hash function will now include hashes of enclosing types if such exist. The main difference from R2R approach is that we do this only for case-sensitive flavor of the table.
Case-insensitive table may be created as needed from case-sensitive prototype. Case-insensitive table by construction shares the encloser items with the prototype table and thus cannot use encloser hashes, since they would not be in the canonical casing.
That basically means the case-insensitive use stays on the same plan as before. It appears to be a relatively rare scenario to support some reflection features.
After measuring, the effects of the change appear to be fairly minor. It does reduce some collisions, but it is not a lot to start with and in case-insensitive case the collisions are still there, so we still have outliers.
I am not sure the result justifies the added complexity.