Skip to content
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

Merged
merged 4 commits into from
Sep 15, 2020

Conversation

geoffkizer
Copy link
Contributor

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

@geoffkizer geoffkizer added this to the 5.0.0 milestone Aug 13, 2020
@ghost
Copy link

ghost commented Aug 13, 2020

Tagging subscribers to this area: @dotnet/ncl
See info in area-owners.md if you want to be subscribed.

@geoffkizer
Copy link
Contributor Author

/azp run runtime-libraries outerloop

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@geoffkizer
Copy link
Contributor Author

/azp run runtime-libraries outerloop

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

}
else if (index <= LastHPackStatusPseudoHeaderId)
{
int statusCode = HPackStaticStatusCodeTable[index - FirstHPackStatusPseudoHeaderId];
Copy link
Member

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?

Copy link
Contributor Author

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.

Copy link
Member

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.

@geoffkizer
Copy link
Contributor Author

@dotnet/ncl can I get a review?

@geoffkizer
Copy link
Contributor Author

@scalablecory Can you do a quick review? It's pretty straightforward.

}
else if (index <= LastHPackStatusPseudoHeaderId)
{
int statusCode = HPackStaticStatusCodeTable[index - FirstHPackStatusPseudoHeaderId];
Copy link
Member

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.

@geoffkizer geoffkizer modified the milestones: 5.0.0, 6.0.0 Sep 15, 2020
@geoffkizer geoffkizer merged commit 3cd27af into dotnet:master Sep 15, 2020
@geoffkizer geoffkizer deleted the http2staticheaders branch November 7, 2020 23:40
@ghost ghost locked as resolved and limited conversation to collaborators Dec 8, 2020
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.

HTTP2: Optimize handling of HPACK static table decoding
3 participants