-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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
HTTP2 Perf: Optimize decoding of HPack static table #40745
Conversation
Tagging subscribers to this area: @dotnet/ncl |
/azp run runtime-libraries outerloop |
Azure Pipelines successfully started running 1 pipeline(s). |
src/libraries/System.Net.Http/src/System/Net/Http/SocketsHttpHandler/Http2Stream.cs
Outdated
Show resolved
Hide resolved
/azp run runtime-libraries outerloop |
Azure Pipelines successfully started running 1 pipeline(s). |
} | ||
else if (index <= LastHPackStatusPseudoHeaderId) | ||
{ | ||
int statusCode = HPackStaticStatusCodeTable[index - FirstHPackStatusPseudoHeaderId]; |
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.
nit: Replace the array lookup with a switch?
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.
That might be slightly better but I'm not sure it matters in practice.
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.
A switch does seem a little better here to me as well, but not a big deal.
src/libraries/System.Net.Http/src/System/Net/Http/SocketsHttpHandler/Http2Stream.cs
Show resolved
Hide resolved
@dotnet/ncl can I get a review? |
@scalablecory Can you do a quick review? It's pretty straightforward. |
src/libraries/System.Net.Http/src/System/Net/Http/SocketsHttpHandler/Http2Stream.cs
Outdated
Show resolved
Hide resolved
src/libraries/System.Net.Http/src/System/Net/Http/SocketsHttpHandler/Http2Stream.cs
Outdated
Show resolved
Hide resolved
src/libraries/System.Net.Http/src/System/Net/Http/SocketsHttpHandler/Http2Stream.cs
Outdated
Show resolved
Hide resolved
} | ||
else if (index <= LastHPackStatusPseudoHeaderId) | ||
{ | ||
int statusCode = HPackStaticStatusCodeTable[index - FirstHPackStatusPseudoHeaderId]; |
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.
A switch does seem a little better here to me as well, but not a big deal.
98133a3
to
00de34b
Compare
Fixes #1505
Currently, when we decode a header ID from the static table, we convert it to the ASCII header name/value and then parse this again in order to determine if it's a known header.
Instead, optimize this by avoiding the conversion to ASCII and simply map it directly to a known header descriptor, or handle it directly if it's a pseudo header (i.e. status code).
@JamesNK @dotnet/ncl