perf: speed up flat tree traversal in modular decode#716
Merged
Conversation
Benchmark @ 05fe313Comparing: e883140e (Base) vs 7d77dfd6 (PR)
|
17 tasks
Member
05fe313 to
e689173
Compare
Member
|
I modified the implementation not to use |
Member
|
Could you rebase now that #787 is merged, and do a benchmark to see the isolated effect of the tree traversal speedup compared to that new baseline? |
On my machine, speeds up sunset-logo.jxl from ~7.7MP/s to ~8.4MP/s (about 10% improvement). No unsafe required.
e689173 to
1c05b2b
Compare
veluca93
approved these changes
Jun 3, 2026
Member
Performance Summary (Commit
|
| Machine | Threading | Base MP/s | PR MP/s | Avg Improvement |
|---|---|---|---|---|
| desktop | Single | 92.09 | 91.92 | +1.70% ± 0.32% |
| desktop | Multi | 91.94 | 91.99 | +1.78% ± 0.39% |
| framework-desktop | Single | 109.22 | 109.54 | +1.51% ± 0.33% |
| framework-desktop | Multi | 110.02 | 109.76 | +1.50% ± 0.23% |
| pixel7a | Single (Fast) | 32.59 | 32.71 | +1.11% ± 0.38% |
| pixel7a | Single (Mid) | 23.61 | 23.61 | +1.18% ± 0.32% |
| pixel7a | Multi | 33.12 | 33.15 | +1.01% ± 0.39% |
jonsneyers
approved these changes
Jun 4, 2026
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.
This stores leaf predictors directly in flat tree nodes and uses an unrolled traversal macro in the hot prediction loop. It removes repeated enum conversion and reduces branching while keeping prediction behavior unchanged. Unsafe is used only for unchecked tree/property indexing where indices are validated during tree decode/flattening and guarded by invariants.