perf(pz2): auto-greedy parse — blob 31.0%, Pareto-superior to pzstd -3#145
Merged
Conversation
The per-file probe (examples/pz2_parse_probe.rs, 2 MiB blocks) overturned the inherited "greedy regresses structured data" rule for the pz2 wire: greedy <= lazy on 11/12 Silesia files (dickens -3.2pp, reymont -3.0, sao -2.3; worst case mozilla +0.03pp = noise). The lazy deferral's win belonged to the flag-stream wire and smaller windows, not to the parse itself at 2 MiB reach. Pz2's Auto strategy now parses greedy per block, with one guard (pz2_auto_greedy): near-random blocks (entropy > 7.5, match density < 0.1 — same rule as select_pipeline) stay lazy since there is no ratio to buy. Explicit --lazy / --greedy respected; other pipelines untouched. Blob e2e: 32.00% -> 31.04% (vs pzstd/zstd-3 31.40%), decode IMPROVES 17.9 -> 16.8 ms all-cores (fewer, longer sequences; 12.0 GiB/s, 1.36x faster than pzstd -3), encode 1.89 -> 3.15 s (64 MiB/s — the P1 trade). pz2 is now Pareto-superior to pzstd -3 on (ratio, parallel decode) and dominates lzf on every axis except encode. 741 + 592 tests, fmt, clippy clean. Co-Authored-By: Claude Fable 5 <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
The per-file probe (
examples/pz2_parse_probe.rs, all 12 Silesia files, 2 MiB blocks) overturned the inherited "greedy regresses structured data" rule for the pz2 wire: greedy ≤ lazy on 11/12 files (dickens −3.2pp, reymont −3.0, sao −2.3, webster/mr −1.9; worst case mozilla +0.03pp = noise). The lazy deferral's advantage belonged to the flag-stream wire and smaller windows, not to the parse itself at 2 MiB reach.Pz2's
Autostrategy now parses greedy per block, with one guard (pz2_auto_greedy): near-random blocks (entropy > 7.5, match density < 0.1 — same rule asselect_pipeline) stay lazy since there's no ratio to buy. Explicit--lazy/--greedyrespected; other pipelines untouched.Results (blob e2e, warm-cache hyperfine)
Decode got faster with greedy — fewer, longer sequences mean fewer entropy symbols and fewer splice iterations (user CPU 181 → 172 ms).
pz2 is now Pareto-superior to pzstd -3 on (ratio, parallel decode): 0.36pp better ratio AND 1.36× faster wall. Encode at 64 MiB/s all-cores is the deliberate decode-first (P1) trade, recoverable later via GPU candidate generation.
Test plan
clean-slate-codec.md§10🤖 Generated with Claude Code