Context
Donor ZSTD_splitBlock (lib/compress/zstd_compress_superblock.c) decides
whether to split a literals/sequences block at intermediate boundaries
to improve ratio. Our block_splitter::should_split uses a different
heuristic and may pick different boundaries than donor on the same input.
Goal
Build a Rust↔FFI boundary comparator that runs both block splitters on
the same input and reports:
- For each input scenario, list of boundaries chosen by Rust vs donor
- Per-scenario divergence count and total compressed-size delta
- Verify: where Rust splits differently AND donor produces smaller
output → port the donor decision logic
Acceptance criteria
- Comparator harness in
tests/ or benches/ reading decodecorpus_files/
- Report shows boundary-by-boundary diff for each scenario
- If divergences correlate with ratio loss → port the donor split logic
- If divergences are neutral (same compressed size) → close as algorithmic
freedom
Files involved
- zstd/src/encoding/block_splitter.rs (current heuristic)
- New harness in zstd/tests/ or zstd/benches/
References
Context
Donor
ZSTD_splitBlock(lib/compress/zstd_compress_superblock.c) decideswhether to split a literals/sequences block at intermediate boundaries
to improve ratio. Our
block_splitter::should_splituses a differentheuristic and may pick different boundaries than donor on the same input.
Goal
Build a Rust↔FFI boundary comparator that runs both block splitters on
the same input and reports:
output → port the donor decision logic
Acceptance criteria
tests/orbenches/readingdecodecorpus_files/freedom
Files involved
References
lib/compress/zstd_compress_superblock.c::ZSTD_splitBlock