[chttp2] Improve huffman decode efficiency#30479
Merged
ctiller merged 137 commits intogrpc:masterfrom Sep 13, 2022
Merged
Conversation
Automated fix for refs/heads/awesome-goats
Automated fix for refs/heads/awesome-goats
Automated fix for refs/heads/awesome-goats
yashykt
reviewed
Sep 12, 2022
| }, | ||
| "off": { | ||
| "core_end2end_tests": [ | ||
| "new_hpack_huffman_decoder", |
Member
Author
There was a problem hiding this comment.
tests get enabled by experiments: we automatically run some subset of the test suite with each experiment in both states (on and off)
| bool done_ = false; | ||
| }; | ||
| } // namespace grpc_core | ||
| #endif // GRPC_CORE_EXT_TRANSPORT_CHTTP2_TRANSPORT_DECODE_HUFF_H No newline at end of file |
Member
There was a problem hiding this comment.
please fix the no new line at end of file
| } else { | ||
| assert(emit == 256); | ||
| if (IsNewHpackHuffmanDecoderEnabled()) { | ||
| // If there's insufficient bytes remaining, return now. |
Member
There was a problem hiding this comment.
Looks like this this if -if (input->remaining() < length)... is the same in the bottom else part. We should be able to bring it out
yashykt
approved these changes
Sep 13, 2022
ctiller
added a commit
that referenced
this pull request
Sep 13, 2022
ctiller
added a commit
that referenced
this pull request
Sep 13, 2022
ctiller
added a commit
that referenced
this pull request
Sep 13, 2022
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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 change introduces a configurable huffman decoding compilation engine, and uses it to generate a reasonably good decoder.
My original hope was to eliminate any lookup tables at all on this path, but I don't have any great ideas on how to do that and still have reasonable build times, so we'll stick to code generation for now.
This version is within a few kb of size of the previous version, and a little over twenty times faster:
Future work will be to tune the generation parameters and generate the absolute optimal arguments for data center and for mobile.
(note: the commits on this change are pretty meaningless - they were more storing intermediate steps during my research as I toyed with how to represent the tables and the tradeoffs in table size versus code size)