Repository navigation
perf(decoding): set sequence table counters in one pass - #682
Conversation
The table build walked the alphabet three times before the per-state pass (zero the counters, place the -1 symbols, lay down the rest) and the lay-down branched on each probability. Upstream's ZSTD_buildFSETable_body walks it once and lays down without a branch. - One pass sets every counter to its probability and places a -1 symbol at the top of the table with a counter of 1. - The lay-down writes the word of a zero-probability symbol too and leaves the position in place, so it takes no branch on the probability; the word steps with the symbol instead of being multiplied out. Output is unchanged. Part of #678
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
No actionable comments were generated in the recent review. Walkthrough
Merge Risk:
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: e17d089a9f
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
## 🤖 New release * `structured-zstd`: 0.4.2 -> 0.4.3 <details><summary><i><b>Changelog</b></i></summary><p> <blockquote> ## [0.4.3](v0.4.2...v0.4.3) - 2026-11-21 ### Performance - *(encoding)* fewer memcpy calls on small dictionary frames ([#691](#691)) - *(encoding)* cheaper dictionary frames at negative levels ([#687](#687)) - *(encoding)* optimal-parser workspace in upstream's shape ([#686](#686)) - *(decoding)* sequence loop common path in assembly on x86_64 ([#683](#683)) - *(decoding)* set sequence table counters in one pass ([#682](#682)) - *(decoding)* four-stream literals in a machine word, asm loop on 32-bit x86 ([#681](#681)) - *(decoding)* four-stream literal loop in assembly ([#679](#679)) </blockquote> </p></details> --- This PR was generated with [release-plz](https://github.com/release-plz/release-plz/). Co-authored-by: sw-release-bot[bot] <255865126+sw-release-bot[bot]@users.noreply.github.com>
Summary
ZSTD_buildFSETable_bodydoes.Changes
Testing
Formatting and clippy pass; the FSE, sequence, decoder and round-trip tests pass.
Interleaved prebuilt-binary run on a Broadwell host, z000033 decode,
--profile benchwith the dashboard'sx86-64-v3; main, this branch and upstream through the C bindings in the same run, ms per frame:Against upstream the decode still takes 1.08-1.11x its time at level 3 (main: 1.11-1.16x) and about 1.1x at levels 13 and 19; the remaining gap is in the sequence loop and is not addressed here.
The level 3 wall-clock gain over main (about 1.2%) is under the layout band of two separate builds, so it is not claimed. The attributable figure is the table build itself at level 19: 2.88G to 2.59G cycles over 3000 frames (-10%), while the sequence loop, which the change cannot execute, moves +0.7% in the same run. Levels 13 and 19 wall-clock are within noise.
Part of #678