Skip to content

Avoid expanding environment-only conflict markers - #2149

Draft
zaniebot wants to merge 5 commits into
zb/resolve-activated-extras-in-bddfrom
zb/restrict-conflict-world
Draft

zaniebot wants to merge 5 commits into
zb/resolve-activated-extras-in-bddfrom
zb/restrict-conflict-world

Conversation

@zaniebot

@zaniebot zaniebot commented Sep 29, 2026 •

Copy link
Copy Markdown
Collaborator

Lockfiles with many tool.uv.conflicts can repeat every invalid extra combination on dependencies whose availability depends only on the environment. Keep the environment marker when it is equivalent for every valid conflict selection, while retaining conflict-dependent and impossible edges needed to diagnose transitive conflicts. Stacks on #2148.

Hyperfine 2.0.0 measurements of 3b3a7b5ed → bcff78c48 used release builds of the complete CLI with rustc 1.99.0 (b940084d7 2026-09-28) on an AMD EPYC-Genoa Linux VM, pinned to four CPUs. Output went to /dev/null. The supplied interpreter was CPython 3.12.13.

Commands include uv lock --no-index --find-links WHEELS. Synthetic conflict workspaces use local wheels and vary mutually exclusive extras, shared package names, and environment-only dependencies; a no-conflict case provides a control. Within the supported Python range >=3.12,<3.14, the root declares extra-000 below Python 3.13 and extra-001 from Python 3.13. Complete uv lock commands perform resolution and serialize new locks. Each command starts a fresh process; OS pages, local wheel metadata, and interpreter-query caches are warm. Fresh-lock cases remove uv.lock outside wall time and RSS. No external index, source backend, or package installation is used.

Values are means, parent → head. Changes are (head / parent - 1) with 95% confidence intervals; negative values indicate a reduction.

Workload Wall time Change, 95% CI Peak RSS Change, 95% CI
lock / 2 extras / 1 shared name / 1 common dependency / conflicts / conditional activation 25.1 → 24.7 ms -1.53% [-3.23%, +0.19%] 38.02 → 38.03 MiB +0.04% [-0.30%, +0.35%]
lock / 8 extras / 1 shared name / 1 common dependency / conflicts / conditional activation 29.4 → 28.9 ms -1.70% [-3.08%, -0.15%] 38.91 → 38.75 MiB -0.41% [-0.73%, -0.09%]
lock / 9 extras / 1 shared name / 1 common dependency / conflicts / conditional activation 29.9 → 29.8 ms -0.27% [-2.05%, +1.49%] 38.99 → 38.82 MiB -0.44% [-0.65%, -0.22%]
lock / 16 extras / 1 shared name / 1 common dependency / conflicts / conditional activation 40.3 → 39.3 ms -2.36% [-3.66%, -1.14%] 41.09 → 41.03 MiB -0.13% [-0.49%, +0.26%]
lock / 30 extras / 1 shared name / 1 common dependency / conflicts / conditional activation 102.3 → 97.6 ms -4.64% [-5.12%, -4.09%] 53.37 → 53.40 MiB +0.04% [-0.14%, +0.23%]
lock / 50 extras / 1 shared name / 1 common dependency / conflicts / conditional activation 566.1 → 515.0 ms -9.03% [-9.63%, -8.50%] 97.49 → 97.51 MiB +0.01% [-0.16%, +0.20%]
lock / 16 extras / 32 shared names / 64 common dependencies / conflicts / conditional activation 206.7 → 182.3 ms -11.83% [-12.96%, -10.40%] 81.01 → 81.37 MiB +0.45% [-0.24%, +1.16%]
lock / 16 extras / 32 shared names / 64 common dependencies / no conflicts / conditional activation 67.5 → 66.8 ms -0.96% [-2.88%, +1.01%] 58.83 → 58.66 MiB -0.30% [-0.81%, +0.21%]

Each workload used ten comparison blocks with alternating revision order, one warmup followed by three measured runs per revision in each block (30 measurements per revision). The pointwise 95% percentile-bootstrap intervals use 20,000 resamples of paired block means and retain all samples. They estimate within-run uncertainty, not variation across machines, independent builds, or separate benchmark campaigns.

The 30- and 50-extra conflict cases ran 4.64% and 9.03% faster, and the wider 16-extra case ran 11.83% faster. The two- and nine-extra cases and the no-conflict control have inconclusive runtime intervals. RSS fell by 0.41% and 0.44% in the eight- and nine-extra cases; the other six RSS intervals include zero. RSS is Hyperfine's Linux wait4 peak, not an allocation count or summed simultaneous process-tree memory.

@codspeed

codspeed Bot commented Sep 29, 2026 •

Copy link
Copy Markdown

Merging this PR will improve performance by ×94

⚡ 6 improved benchmarks
✅ 67 untouched benchmarks
⏩ 47 skipped benchmarks1

Performance Changes

Mode Benchmark BASE HEAD Efficiency
⚡ WallTime imbibe_and_format[32] 3,380.8 µs 1.3 µs ×2,600
⚡ Simulation imbibe_and_format[32] 82,108.4 µs 65.2 µs ×1,300
⚡ WallTime imbibe_and_format[16] 163,803 ns 871 ns ×190
⚡ Simulation imbibe_and_format[16] 3,661.1 µs 51.9 µs ×71
⚡ WallTime imbibe_and_format[4] 3,282 ns 514 ns ×6.4
⚡ Simulation imbibe_and_format[4] 104.6 µs 41.2 µs ×2.5

Tip

Curious why performance improved? Comment @codspeedbot explain why performance improved on this PR, or directly use the CodSpeed MCP with your agent.


Comparing zb/restrict-conflict-world (bcff78c) with zb/resolve-activated-extras-in-bdd (3b3a7b5)

Open in CodSpeed

Footnotes

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

@zaniebot
zaniebot force-pushed the zb/restrict-conflict-world branch from 747d45b to 95ecc61 Compare September 29, 2026 22:33
@zaniebot
zaniebot changed the base branch from zb/bench-universal-conflict-markers to zb/resolve-activated-extras-in-bdd September 29, 2026 22:34
@zaniebot
zaniebot added this pull request to stack #2155 September 29, 2026 22:34
@zaniebot
zaniebot removed this pull request from stack #2155 October 7, 2026 23:37
@zaniebot
zaniebot added this pull request to stack #2337 October 7, 2026 23:38
@zaniebot
zaniebot removed this pull request from stack #2337 October 8, 2026 00:02
@zaniebot
zaniebot added this pull request to stack #2339 October 8, 2026 00:02
@zaniebot
zaniebot deployed to automations October 8, 2026 00:03 — with GitHub Actions Active
@zaniebot
zaniebot removed this pull request from stack #2339 October 8, 2026 00:19
@zaniebot
zaniebot added this pull request to stack #2340 October 8, 2026 00:19
charliermarsh pushed a commit to astral-sh/uv that referenced this pull request Oct 16, 2026
Keep an environment marker when it describes the dependency under every valid conflict selection. Retain conflict-dependent and impossible edges so lockfile readers can still discover conflicting transitive extras.

Port astral-sh#2149. Related to #21954.
charliermarsh added a commit to astral-sh/uv that referenced this pull request Oct 18, 2026
## Summary

When a project declares mutually exclusive extras, we can add every
forbidden pair to dependency markers that otherwise depend only on
Python version or platform. This makes those markers grow quadratically
with the number of conflicting extras.

We now keep just the environment condition when it describes the
dependency for every valid selection. For example, with mutually
exclusive extras `a` and `b` (using shortened extra names):

```diff
-python_full_version < '3.11' or (extra == 'a' and extra == 'b')
+python_full_version < '3.11'
```

Removing these terms before DNF conversion reduces conversion and
serialization work. The narrower environment markers also let us discard
wheels that are unreachable in every valid selection. We retain
conflict-dependent and impossible edges so lockfile readers can still
discover and report conflicting extras requested by transitive
dependencies.

| Items in conflict set | Pairwise construction | Union construction |
| --- | ---: | ---: |
| 2 | 165 ns | 165 ns |
| 8 | 4.99 µs | 0.772 µs |
| 32 | 83.8 µs | 3.12 µs |
| 128 | 1.66 ms | 12.4 µs |

Ports astral-sh#2149. Related to #21954.

---------

Co-authored-by: Zanie Blue <contact@zanie.dev>
charliermarsh pushed a commit to astral-sh/uv that referenced this pull request Oct 18, 2026
Keep an environment marker when it describes the dependency under every valid conflict selection. Retain conflict-dependent and impossible edges so lockfile readers can still discover conflicting transitive extras.

Port astral-sh#2149. Related to #21954.

This branch was successfully deployed

1 active deployment
automations — bcff78c4 Deployed Oct 8, 2026 by zaniebot via review-code-quality / code quality review #7905
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants