Background
Audit against rez/src/rez/SOLVER.md flagged that rer's PackageVariantSlice is missing two per-slice caches that rez uses to skip redundant work:
been_intersected_with — records ranges a slice has already been intersected with; `intersect()` short-circuits if the incoming range is already covered.
been_reduced_by — records package requests a slice has already been reduced by; `reduce_by()` short-circuits on repeats.
In rez these are part of the "optimised mode" path on `_PackageVariantSlice` (`rez/src/rez/solver.py:566+`).
Impact
- Correctness: none. rer redoes work that rez would skip, but the result is identical. This is consistent with rer matching rez 1:1 on the 188-case benchmark.
- Performance: rer is already faster than rez on the benchmark (~44s vs ~206s), so there's no urgency, but the headroom is real — the redundant intersect/reduce work shows up in the hot loop.
What to do
- Add two fields to `PackageVariantSlice` (`crates/rer-resolver/src/rez_solver/variant.rs:476-493`):
- `been_intersected_with: FxHashSet` (or equivalent)
- `been_reduced_by: FxHashSet` (or equivalent)
- In `intersect()` (`variant.rs:588-606`): if the incoming range is in `been_intersected_with`, return `Unchanged`.
- In `reduce_by()` (`variant.rs:609-674`): if the incoming request is in `been_reduced_by`, return `Unchanged`.
- Decide on cache cloning behaviour: rez keeps the cache when entries are unchanged, drops it on `copy_with_entries`. Match that.
- Re-run the rez benchmark and report timing delta.
References
- rer slice: `crates/rer-resolver/src/rez_solver/variant.rs:476-493`
- rez slice: `rez/src/rez/solver.py:566+`
- SOLVER.md mentions these as part of the "immutability optimization" pattern (~line 158)
Background
Audit against
rez/src/rez/SOLVER.mdflagged that rer'sPackageVariantSliceis missing two per-slice caches that rez uses to skip redundant work:been_intersected_with— records ranges a slice has already been intersected with; `intersect()` short-circuits if the incoming range is already covered.been_reduced_by— records package requests a slice has already been reduced by; `reduce_by()` short-circuits on repeats.In rez these are part of the "optimised mode" path on `_PackageVariantSlice` (`rez/src/rez/solver.py:566+`).
Impact
What to do
References