perf: use native words in IndexedSet and hoist forbid lookups - #288
Merged
baszalmstra merged 1 commit intoAug 26, 2026
Merged
Conversation
baszalmstra
force-pushed
the
perf/resolvo-encoding-optimizations
branch
from
August 26, 2026 08:19
224ed15 to
d87921e
Compare
Store IndexedSet bits in native machine words and resolve a candidate list's name once when registering forbid targets. Add the candidate-list name invariant in debug builds and keep IndexedSet's coverage next to its implementation.
baszalmstra
force-pushed
the
perf/resolvo-encoding-optimizations
branch
from
August 26, 2026 08:19
d87921e to
8cd80b3
Compare
Merged
4 tasks
Contributor
|
@baszalmstra What is the impact on memory usage? |
Contributor
Author
|
I didnt measure! But I expect very little since this is only used with dense layouts. |
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.
IndexedSetis backed by a growableVec<usize>bitset, using the native machine word size while preserving the existing set API.The encoder also resolved a solvable's package name and looked up its pending forbid-clause bucket once per candidate. Candidates in one version-set candidate list share a package name, so this now happens once per list. The
allow_multiplecheck and forbid bookkeeping move out of the inner loop as well.What changed
IndexedSetbits in native machine words and remove the unusedbitvecdependency.allow_multiple.Benchmarks
Benchmarked with a 1,134,320-record conda-forge snapshot using 351 fixed-seed, precomputed workloads. Both builds used the same requirement sequence, a 60-second per-solve timeout, and produced identical outcome categories: 129 solved and 222 unsatisfiable.
This reduces total solve time by 24.18 s (18.6%), or 1.23x throughput.
339 of 351 problems are faster. The largest improvement is 358 ms; the largest regression is 25 ms.
Testing
pixi run -e test-rust cargo fmt --checkpixi run -e test-rust cargo test --all-features