Repository navigation
Cache clause differences when simplifying large marker DNFs - #22606
charliermarsh merged 1 commit into
Conversation
46a85ce to
55ea49b
Compare
55ea49b to
61248ae
Compare
Merging this PR will regress 2 benchmarks
|
| Mode | Benchmark | BASE |
HEAD |
Efficiency | |
|---|---|---|---|---|---|
| ❌ | Simulation | imbibe_marker_no_conflicts[0] |
343 ns | 398.5 ns | -13.94% |
| ❌ |
Simulation | discover_workspace_from_all_members |
134.5 ms | 142.9 ms | -5.88% |
| ⚡ | WallTime | imbibe_and_format_marker_conflict_dependent[32] |
15.8 ms | 5.8 ms | ×2.8 |
| ⚡ | WallTime | marker_to_dnf_conflicting_extras[32] |
4 ms | 1.9 ms | ×2.1 |
| ⚡ | Simulation | imbibe_and_format_marker_conflict_dependent[32] |
297.2 ms | 150.6 ms | +97.35% |
| ⚡ | Simulation | marker_to_dnf_conflicting_extras[32] |
73.6 ms | 48.2 ms | +52.64% |
| ⚡ |
Simulation | discover_workspace_from_all_members_with_excludes |
163.9 ms | 155.5 ms | +5.39% |
Tip
Investigate this regression by commenting @codspeedbot fix this regression on this PR, or directly use the CodSpeed MCP with your agent.
Comparing charlie/marker-dnf-candidates (6e34068) with charlie/marker-dnf-bitsets (74ec208)
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. ↩
61248ae to
c5d490e
Compare
c5d490e to
fb694a9
Compare
fb694a9 to
9374f28
Compare
9374f28 to
c382f59
Compare
c382f59 to
9061b45
Compare
9061b45 to
5e95425
Compare
5e95425 to
647406c
Compare
647406c to
6e34068
Compare
Large marker DNFs often reuse a small set of terms across many clauses. The indexed simplifier recomputes the difference between two clauses for each term it considers removing. Compute viable differences once per clause and reuse them across those term checks. Count missing terms first to discard candidates that cannot justify a removal, then update the cached differences after each removal so later checks use the surviving terms. Enable this path only when enough clauses reuse relatively few terms; smaller and sparser DNFs retain direct comparisons. Differential tests check that both paths produce the same ordered output as the linear simplifier.
6e34068 to
86706d3
Compare
Summary
When simplifying a DNF, we can compare each clause with the others for every term we consider removing. For markers with many clauses that reuse the same terms, as with conflicting extras, we can end up computing the same differences over and over.
This PR caches the relevant differences for each clause and reuses them as we check its terms. We skip candidates that cannot justify a removal, and update the cached differences when a term is removed so later comparisons see the updated clause.
We use this path for large DNFs with relatively few distinct terms. Smaller or sparser expressions continue to use the comparisons introduced in #22604. The DNF still needs to be created, and the number of clause comparisons can still be quadratic.
CodSpeed comparison against #22604 measures the 25 marker cases in both walltime and simulation. CodSpeed flags a simulation environment difference; the wall-time results have no runner mismatch.