Use fast hashing helpers for types with trailing padding #118986
Merged
+61
−23
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.
This is same as #111620 but with an extra thing: enable unconditional method body folding on
__GetFieldHelper
overrides (both the simplified ones that just return a negative number and normal ones).Before this PR we considered valuetypes as byte-hashable/comparable only if the valuetype didn't have any trailing padding.
This fixes things up so that we can consider types with trailing padding byte-hashable/comparable if the other requirements still hold (such as no double/float fields, no GC references, etc.) and there is a trailing padding. In this case, we remember the number of bytes that we should be looking at and ignore the rest.
Since this doesn't seem to provide meaningful size savings according to rt-sz, this is a throughput improvement, not a size improvement.
Before:
After:
Resolves #111542
Cc @dotnet/ilc-contrib