refactor: pluggable wire encoders and remove Pipeline::Lzr#118
Merged
Conversation
Two interleaved changes: 1. Pluggable wire encoders: New `src/lz_token.rs` with universal `LzToken` type, `TokenEncoder` trait, and three encoder implementations: - `Lz77Encoder`: DEFLATE-compatible 3-stream format - `LzSeqEncoder`: log2-coded 6-stream format (best ratio) - `LzssEncoder`: flag-based 4-stream format Match finders now produce `Vec<LzToken>` via `tokenize()`, and encoders convert token streams to independent byte streams for entropy coding. This decouples match finding from wire encoding. 2. Remove Pipeline::Lzr: After the wire encoder refactor, Lzr became identical to LzSeqR (same demuxer, match finder, wire encoder, and entropy coder). Removed from enum, dispatch tables, CLI, tests, benchmarks, examples, scripts, and fuzz targets. Pipeline ID 3 reserved with tombstone comment. Additionally, Lzf's demuxer switches from Lz77 to LzSeq, upgrading its compression ratio from ~41% to ~32% on typical data. Wire format break (pre-1.0): SortLz now uses LzSeq-encoded streams + FSE instead of hand-rolled flag/offset/length FSE streams. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Add debug_assert for input_pos bounds in Lz77Encoder::encode - Wire SeqConfig.max_match_len through encode_from_tokens - Return PzResult from demux_lz77_matches instead of panicking Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
4 tasks
ChrisLundquist
added a commit
that referenced
this pull request
Mar 12, 2026
Add architecture section documenting the unified token pipeline (PR #118), active/removed pipelines table, and Silesia corpus benchmark data. Update project layout to reflect lz_token.rs and removed modules. Update dead ends with streaming path bottleneck finding and LzSeqR routing bug (PR #120). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
3 tasks
ChrisLundquist
added a commit
that referenced
this pull request
Mar 12, 2026
* bench: enable parallel, large, and webgpu benchmarks for Lzfi Lzfi was only benchmarked on the small Canterbury corpus with no parallel, large-file, or WebGPU variants. Enable all modes to match the LzSeqR and Lzf benchmark coverage. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * docs: update CLAUDE.md with architecture overview and Silesia benchmarks Add architecture section documenting the unified token pipeline (PR #118), active/removed pipelines table, and Silesia corpus benchmark data. Update project layout to reflect lz_token.rs and removed modules. Update dead ends with streaming path bottleneck finding and LzSeqR routing bug (PR #120). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
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.
Summary
TokenEncodertrait with 3 implementations (Lz77Encoder,LzSeqEncoder,LzssEncoder). Match finding is decoupled from wire encoding via a universalLzTokentype andtokenize()entry point.LzDemuxer::Lz77(3 streams, ~41% ratio) toLzDemuxer::LzSeq(6 streams, ~32% ratio).LzSeqEncoder, removing ~164 lines of duplicate encode/decode logic. Wire format v2.u16::MAXviaadjusted_options(), threaded throughSeqConfig→HashChainFinder.Key files
src/lz_token.rsLzToken,EncodedStreams,TokenEncodertrait, 3 encoder implssrc/lzseq/mod.rsencode_from_tokens(),max_match_leninSeqConfigsrc/pipeline/demux.rsencoder_for_demuxer()dispatch,demux_lz77_matchesreturnsPzResultsrc/pipeline/mod.rstokenize()replaceslz77_matches_with_backend(), Lzr removedsrc/sortlz.rsLzSeqEncoderfor wire encoding (-164 lines)Test plan
cargo clippy --all-targets— zero warningscargo test— 706 tests pass, 0 failures🤖 Generated with Claude Code