Skip to content

Share DNF simplification across clause representations - #22626

Merged
charliermarsh merged 4 commits into
charlie/compact-conflict-markersfrom
charlie/shared-dnf-simplifier
Oct 16, 2026
Merged

charliermarsh merged 4 commits into
charlie/compact-conflict-markersfrom
charlie/shared-dnf-simplifier

Conversation

@charliermarsh

@charliermarsh charliermarsh commented Oct 15, 2026 •

Copy link
Copy Markdown
Member

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:

Operation Parent This PR Change
to_dnf, two clauses 0.849 µs 0.863 µs +1.6%
to_dnf, mixed clauses 1.546 µs 1.583 µs +2.4%
to_dnf, 32 conflicting extras 4.138 ms 3.972 ms −4.0%
to_dnf, 512 sparse clauses 8.753 ms 8.735 ms −0.2%
imbibe and format, conflict-dependent marker [4] 6.719 µs 6.452 µs −4.0%
imbibe and format, conflict-dependent marker [32] 12.364 ms 12.055 ms −2.5%

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.

@codspeed

codspeed Bot commented Oct 15, 2026 •

Copy link
Copy Markdown

Merging this PR will regress 1 benchmark

⚠️ 8 benchmarks spent significant time in system calls

System calls cannot be consistently instrumented, so they are not included in the measure, which understates the real cost. Please switch to the Walltime instrument to accurately measure system calls.

Measurement and system calls

⚡ 6 improved benchmarks
❌ 1 regressed benchmark
✅ 112 untouched benchmarks
⏩ 54 skipped benchmarks1

Warning

Please fix the performance issues or acknowledge them on CodSpeed.

Performance Changes

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)

Open in CodSpeed

Footnotes

  1. 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. ↩

@charliermarsh
charliermarsh force-pushed the charlie/shared-dnf-simplifier branch from f25b35f to b8c44d3 Compare October 16, 2026 15:10
Base automatically changed from charlie/marker-dnf-candidates to charlie/compact-conflict-markers October 16, 2026 15:10
@charliermarsh
charliermarsh merged commit b8c44d3 into main Oct 16, 2026
@charliermarsh
charliermarsh deleted the charlie/shared-dnf-simplifier branch October 16, 2026 15:10
@charliermarsh
charliermarsh restored the charlie/shared-dnf-simplifier branch October 16, 2026 15:11

This branch was previously deployed

1 inactive deployment
automations — b8c44d31 Deployed Oct 16, 2026 by charliermarsh via review / security review #51354
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant