Repository navigation
Accelerate RAR 2.0 Huffman and bit decoding - #102
Merged
Merged
Conversation
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.
RAR 2.0 decoded every Huffman symbol and multi-bit field one bit at a time. Reuse the shared 10-bit canonical lookup for the main LZ alphabet and read multi-bit fields a byte at a time, preserving the original results, diagnostics, and bit consumption on errors.
Keep level, distance, length, and audio tables bitwise: their setup cost and frequent one-bit audio codes do not benefit reliably from a lookup. A compile-time mode keeps that choice explicit without adding runtime state. Quota-limited readers retain their symbol-only table allocations and allocation-refusal behavior. Unlimited readers add one 4 KiB main lookup, also copied by checkpoints.
Add exhaustive comparisons with the original bitwise logic for both decoding modes and budget policies, including input tails, errors, clones, and compaction. Add
cargo bench -p rars --bench rar20_decodewith eight generated, round-trip-checked fixtures; fresh decoders deliberately include table setup.Measured in three alternating runs against master using public decoder calls:
Validation:
claude -pplan, refinement, and final reviews: approved, no blocking findings.