ishaaaan17 opened a new pull request, #13925:
URL: https://github.com/apache/trafficserver/pull/13925
following up on the suggestion from @bneradt on #13901:
### description
in #13901, we updated `xpack_encode_string` to prefer the raw representation
whenever huffman coding does not save space (`data_len >= value_len`). however,
for incompressible values, we were still encoding into a temporary
`ts::LocalBuffer` only to discard the result.
this pr computes the encoded huffman length upfront using the static
`encode_table` (`(nbits + 7) / 8`), similar to `nghttp2_hd_huff_encode_count`.
if the string is incompressible or a tie, the encoder avoids allocating the
scratch buffer and skips the throwaway huffman encoding pass entirely, writing
the raw string directly into the output.
### verification
- added an upfront length parity check in `test_Huffmancode.cc` under
`decoder_roundtrip_fuzz` verifying `huffman_encoded_len(src, len) ==
huffman_encode(...)` across 20,000 fuzz rounds of random bytes and lengths.
- ran all header and hpack test suites locally:
- `test_proxy_hdrs [huffman]`: all passed (475,676 assertions)
- `test_proxy_hdrs_xpack`: all passed (243 assertions)
- `test_HPACK`: regression passed
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]