Repository navigation
Use shared PubGrub incompatibility storage - #22771
charliermarsh wants to merge 1 commit into
Conversation
Merging this PR will improve performance by 16.2%3 warnings
Performance Changes
Tip Curious why performance improved? Comment Comparing Footnotes
|
When a resolution forks, we currently clone the solver for every pending sibling even though we solve them sequentially. We share one checkpoint between pending siblings and materialize each solver state only when it runs. The last sibling takes ownership of the checkpoint. Metadata prefetch still visits every sibling eagerly. On a 7,777-package project, peak RSS fell 9.4% for a fresh lock and 7.1% for an upgrade, while median runtime rose 2.7% and 1.9%, respectively. These are four-run medians on one Linux host. [#22771](#22771) measures the three resolver memory changes together.
0b7032c to
13f81d1
Compare
Store each incompatibility in an Arc. Cloning a solver state copies the arena's vector of handles. Updating a shared contradiction cache through Arc::make_mut copies only the affected record. Compare uv main at 2b50cbc0 (PubGrub 0.6.1) with the original heads of #90 (307ac04) and astral-sh/uv#22771 (0b7032ce), before deferred fork cloning landed. This patch uses that same uv main. PubGrub diff uv diff Original PRs +277 / -144 +166 / -169 Per-record sharing (this) +6 / -11 dependency pin only The PubGrub count for #90 is against its own parent. Updating from 0.6.1 to its head also picked up earlier changes (+753/-492 total). This patch changes 17 lines in one file and needs no uv source edits. Times are geometric means ± one standard error (SE). Average log times, or paired same-round log ratios, within each devbox first. Estimate the SE across devbox means and convert it back to timing units. For a change expressed in percent, the SE is in percentage points. RSS is median process peak memory. Fresh offline lock on a generated graph with a late fork Baseline Full PRs This patch Wall time (ms) 178.5 ± 1.0 146.0 ± 0.5 145.7 ± 1.3 Peak uv RSS (MiB) 93.5 70.8 69.5 Time vs baseline (%) — -18.22 ± 0.16 -18.40 ± 0.30 The root requires Python >=3.10 and the first of 160 packages in a chain. Each package pins the same 32 leaves and, until the last, its successor at version 1. At the end, 16 mutually exclusive python_full_version markers select versions 1 through 16 of one package (3.10.0 through 3.10.14, then >=3.10.15). All wheels are generated locally. Each build ran six fresh locks per Linux devbox on two devboxes with a primed cache, no index and rotated order. All builds produced the same lock on each host. This patch saved 25.7% peak RSS against baseline and the full PRs saved 24.3%. Its paired wall-time change versus the full PRs was -0.22 ± 0.57%. Upstream uv resolver suite, wall time in milliseconds Workload Baseline Full PRs This patch Patch vs full (%) Jupyter 14.90 ± 0.15 14.94 ± 0.13 15.20 ± 0.21 +1.74 ± 1.58 Jupyter universal 66.6 ± 0.6 66.4 ± 0.6 67.1 ± 0.9 +1.12 ± 0.74 Airflow 169.9 ± 1.8 167.8 ± 2.2 172.5 ± 2.9 +2.78 ± 0.50 Airflow universal 495.9 ± 1.7 492.9 ± 1.8 498.6 ± 2.1 +1.16 ± 0.32 Peak process RSS in MiB Workload Baseline Full PRs This patch Jupyter 32.1 32.0 32.1 Jupyter universal 44.0 43.5 43.9 Airflow 122.2 123.1 123.2 Airflow universal 145.7 144.3 144.6 Each upstream case ran 40 times per build across four devboxes, including the universal Airflow case disabled in CI. Paired peak RSS differed by at most 0.7% between this patch and the full PRs. The uv binaries used Rust 1.99 and Cargo's profiling profile. End-to-end uv, change from full PRs across 21 fixed upstream workloads Mode Wall time (%) Peak RSS (%) Warm -1.49 ± 0.84 +0.1 Cold +1.26 ± 1.40 +0.5 Incremental -1.34 ± 0.69 -0.3 No-op -0.27 ± 0.52 -0.1 Each workload has equal weight. The CLI SE propagates within-workload paired timing variance on the log scale, treating the measurements of different workloads as independent. Cold runs include network time. All 84 workload/mode combinations produced identical output across builds. Three unsatisfiable inputs reached the same dependency conflicts. The allocation per record also affects unforked solves. PubGrub's standalone backtracking_singletons benchmark took 42.9% longer than 0.6.1 (standard error 5.7 percentage points, three paired runs). The exposed 0.6.1 arena loses range indexing and mutable ID indexing now requires T: Clone. Self-dependency diagnostics follow 0.6.1. #90 astral-sh/uv#22771
Use the shared incompatibility arena from PubGrub #90. Immutable records share 256-record chunks, while each solver state keeps its own contradiction cache. This is an alternative to #22784 and needs a PubGrub release before landing.
These historical four-run medians compare an earlier dependency update with main, before #22769 and PubGrub 0.7.0 landed, on a large project. That update also included other upstream changes, so the savings cannot be attributed solely to chunk sharing. The current rebased PR has not been benchmarked against current main.