Repository navigation
Share DNF simplification across clause representations - #22626
charliermarsh merged 4 commits into
Conversation
Merging this PR will regress 1 benchmark
|
| Mode | Benchmark | BASE |
HEAD |
Efficiency | |
|---|---|---|---|---|---|
| ❌ |
Simulation | discover_workspace_from_all_members |
142.9 ms | 153.8 ms | -7.08% |
| ⚡ | Simulation | imbibe_and_format_marker_conflict_dependent[16] |
11 ms | 6.2 ms | +77.67% |
| ⚡ | Simulation | marker_to_dnf_conflicting_extras[16] |
3.2 ms | 2 ms | +61.06% |
| ⚡ | WallTime | marker_to_dnf_conflicting_extras[16] |
175.9 µs | 133 µs | +32.18% |
| ⚡ | WallTime | imbibe_and_format_marker_conflict_dependent[16] |
590.5 µs | 453.2 µs | +30.31% |
| ⚡ |
Simulation | discover_workspace_from_all_members_with_excludes |
155.5 ms | 143.9 ms | +8.06% |
| ⚡ | Simulation | marker_to_dnf_sparse_clauses[128] |
5.8 ms | 5.4 ms | +6.47% |
Tip
Investigate this regression by commenting @codspeedbot fix this regression on this PR, or directly use the CodSpeed MCP with your agent.
Comparing charlie/shared-dnf-simplifier (f25b35f) with charlie/marker-dnf-candidates (6e34068)
Footnotes
-
54 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports. ↩
f25b35f to
b8c44d3
Compare
Summary
We currently have separate DNF simplification passes for direct comparisons, indexed comparisons, and cached clause differences. Each pass has to remove terms and clauses in the same order, since one removal can affect the next.
This PR shares the ordered removal pass through a private trait for clause comparisons. Small markers still compare expressions directly, without interning their terms. Larger markers use the existing bitsets and cached differences. Each representation keeps its own removal state, and the caching choice stays inside the indexed implementation. Redundant clauses use indexed Boolean flags, with inline storage for small DNFs, so membership checks remain constant-time. The original linear simplifier is compiled only for tests, where it checks the exact ordered output of both representations.
Stacked on #22606. We retain the existing indexing thresholds, repeated-term fallback, and index memory limit.
Native Criterion measurements on a quiet Linux devbox compare the parent (
6e34068) with this PR (f25b35f). Both use uv's allocator and the same Ohm 1.98.1 compiler and profiling profile. Negative changes mean less time:to_dnf, two clausesto_dnf, mixed clausesto_dnf, 32 conflicting extrasto_dnf, 512 sparse clausesimbibeand format, conflict-dependent marker [4]imbibeand format, conflict-dependent marker [32]Each value is the median of three process estimates, with 20 Criterion samples per run and versions interleaved on the same pinned core. Diagrams are built before timing. These short runs do not reliably distinguish changes of a few percent, and operation measurements do not establish a lock or export speedup. DNF creation and quadratic clause comparisons remain.
Stack: #22610 → #22608 → #22615 → #22604 → #22606 → #22626.