ishaaaan17 commented on PR #13925: URL: https://github.com/apache/trafficserver/pull/13925#issuecomment-6837350693
Thanks @bryancall and @bneradt for the review and for running the profiling! Passing `value_len - 1` to `huffman_encode` and doing it in a single pass worked out well. It keeps the >2x speedup on raw values, and the slowdown my earlier 2-pass version had on compressible headers is gone. To address the inline comments from @bneradt as well: - **Single pass / double walk:** sizing the destination buffer to `value_len - 1` lets the encoder stop early on the first pass whenever Huffman is not better than raw. No double walk, and no need to shift the buffer into `p`. - **Buffer size & heap allocations:** changed `local_buffer(max_expected_size)` to `local_buffer(value_len)`. The `value_len * 4` multiplier is removed, so there is no overflow risk, and typical headers stay on the stack. - **Doc comment in `HuffmanCodec.h`:** reverted `HuffmanCodec` and the `lshpack` files back to master, since `huffman_encoded_len` is not needed anymore. - **Tie case test:** added a test in `test_XPACK.cc` for `"XZ"` (2 bytes raw, and exactly 2 bytes in Huffman) to check that a tie takes the raw path. All local unit tests pass. Let me know if anything else needs to change! -- 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]
