We extract marker DNF directly from the decision diagram with a memoized
ISOP algorithm, instead of enumerating paths and simplifying the
resulting clauses. This avoids expensive clause comparisons for markers
with many conflicting extras and replaces #22640, #22641, and #22642.
Marker strings can change, but remain logically equivalent. We also fix
Python-version complexification to preserve the variable ordering
required by the traversal.
Warm medians in microseconds, comparing #22642 (`21f4b07`) with this PR
(`f9df0b8`):
| Operation | #22642 | This PR | Speedup |
| ---------------------------------------- | ------: | ------: | ------:
|
| Two-clause DNF | 0.606 | 0.433 | 1.4× |
| Mixed Python/platform DNF | 1.125 | 0.658 | 1.7× |
| Sparse DNF, 512 clauses | 8,010.3 | 65.0 | 123× |
| Conflict DNF, 32 extras | 2,959.6 | 46.0 | 64× |
| Conflict-dependent formatting, 32 extras | 8,690.4 | 109.9 | 79× |
Measured on a pinned AMD EPYC Linux core with Rust 1.99.0-dev / Ohm,
using 48 samples across three cohorts. Input construction is untimed.
These are warm-interner microbenchmarks, not end-to-end resolution
timings. The first mixed conversion in a fresh process is slightly
slower: 16.6 µs → 20.3 µs.
Summary
We convert decision diagrams to disjunctive normal form (DNF) when rendering markers, then simplify the result by comparing clauses and removing redundant terms. When there are many conflicting extras, the DNF can contain a lot of clauses, and those comparisons can be expensive (see #21954).
This PR makes the comparisons cheaper for larger DNFs. We assign each distinct marker term an integer and represent each clause as a bit set, so we can compare sets instead of repeatedly comparing full marker expressions. We keep the same removal order, since removing one term can affect later comparisons.
For small DNFs, clauses with repeated terms, or expressions that would need a bit-set index larger than 32 MiB, we fall back to the existing simplifier. We also use indexed term lookups for sparse clauses.
We still build the DNF and perform up to a quadratic number of clause comparisons. Boolean operations that already avoid DNF and environment-only conflict markers that are narrowed before DNF conversion do not use this path.