Repository navigation
Conversation
Codecov Report❌ Patch coverage is
Flags with carried forward coverage won't be shown. Click here to find out more.
... and 2 files with indirect coverage changes 🚀 New features to boost your workflow:
|
jesup
force-pushed
the
decompress-dictionaries
branch
from
November 6, 2026 16:52
e9deb75 to
b4d0028
Compare
LLVM lowers inline thresholds for code that is cold in a PGO profile, which leaves calls like `Writer::subslice` in the sequence loop. Firefox PGO training does not exercise zstd, so this is the configuration it ships.
PGO builds turned the element-wise `fill` into two byte stores per entry.
LLVM vectorized the per-byte loop on x86-64 only without PGO, and not at all on aarch64.
`ZSTD_execSequence` already guarantees the sequence fits before `oend`, so the per-sequence `Writer` bounds check is redundant. Keep `new_seq_state` out of line: inlining it makes the x86-64 loop allocate registers noticeably worse. On targets other than x86_64, force it inline with the new `pgo` feature: out of line the sequence state stays in memory, which made trained and cold PGO builds up to 10% slower on Apple silicon. Without PGO forcing it inline is slower, so the compiler decides. The long sequence decoder always calls the out of line version.
The 16-byte over-copy relies on the same output slack as wildcopy.
Makes `is_last_sequence` a constant in the loop.
jesup
force-pushed
the
decompress-dictionaries
branch
from
November 10, 2026 17:15
b4d0028 to
a78fd94
Compare
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.
Builds on PR #499 (decompress-pgo-robustness); only the last 3 commits are new.
ZSTD_copy16instead of callingmemmove; the over-write is covered by the sameoMatchEnd <= oend_wguarantee wildcopy relies on. C still callsmemmovehere.is_last_sequenceis a constant in the loop.Measured on Zen 3 with a harness that decodes the way Firefox does (fresh DStream per response, 16 KB input chunks, 128 KB output buffer), cycles per decompressed byte. "Cold PGO" is instrumented with a profile that never decodes zstd, which is what Firefox ships, since its PGO training has no zstd content; "trained" includes zstd decoding in the training. Dictionary cases: web resources under 60 KB, with a 110 KB trained dictionary or a 232 KB raw-content dictionary, loaded per response with
ZSTD_DCtx_loadDictionary.Non-dictionary decoding is unchanged within noise.
On an Apple M-series Mac (wall-clock, same harness), this PR and its parent decode about 4% faster than main without PGO, 10% faster with cold PGO and 4% faster with trained PGO; dictionary inputs are 5% faster without PGO, 12% faster with cold PGO and 6% faster with trained PGO.
Each commit builds, is rustfmt-clean and passes
cargo test.