Make System.Net.Http.HPack.IntegerDecoder
a struct
#54209
Merged
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.
Description
System.Net.Http.HPack.IntegerDecoder
is a mutable reference type containing two signed 32-bit integers. This PR makes it a struct, eliminating one small allocation per HTTP/2 or 3 connection and providing better locality. On 64-bit platforms the classes that useIntegerDecoder
have no size difference while on 32-bit ones they will gain four additional bytes.If it gets accepted, I will also file a corresponding PR on
aspnetcore
.Customer Impact
An allocation of 24/16 bytes per HTTP/2 or 3 connection, on 64/32-bit platforms.
Regression
No
Testing
N/A
Risk
The risk is minimal; there is no behavior change. Future code should be careful to not store
IntegerDecoder
on areadonly
field; existing uses were updated.