Skip to content

Index reinstall package selections - #265

Draft
zaniebot wants to merge 1 commit into
mainfrom
zb/bughuntperf/251-reinstall-membership
Draft

zaniebot wants to merge 1 commit into
mainfrom
zb/bughuntperf/251-reinstall-membership

Conversation

@zaniebot

@zaniebot zaniebot commented Jul 16, 2026 •

Copy link
Copy Markdown
Collaborator

uv pip install and uv pip sync repeatedly check resolved or installed distributions against --reinstall-package. Index multi-package selections in the resolver and share the owned index across exclusion clones. The install planner uses a borrowed index when both the selection and resolution contain multiple packages. Empty and single-name selections remain on the direct path, and path-based reinstall remains independent of name membership.

Hyperfine 2.0.0 measurements of d644be28b → da2bcf884 used release builds with Rust 1.99.0 and CPython 3.12.13 on an AMD EPYC-Genoa Linux VM, pinned to four CPUs. The command was uv pip install -r requirements.in --dry-run --upgrade --no-index --find-links WHEELS --python VENV_PYTHON, with --offline --no-config --color never --cache-dir CACHE. Output went to /dev/null.

Each requested 1.0.0 package is already installed, and valid local wheels provide the same versions. --upgrade forces resolution despite the satisfied versions; --reinstall-package is repeated for each selected name to choose the replacement plan. Empty, single-name, and multi-name selections cover construction and membership costs. The one-package, 1,024-absent-name case is a construction-cost control. Every process resolves the local requirements and computes a plan. The dry run excludes actual file removal and installation. OS pages, interpreter queries, and wheel metadata caches were warm.

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
64 packages / 0 present reinstall names 72.5 → 72.6 ms +0.15% [-0.44%, +0.79%] 34.69 → 34.52 MiB -0.47% [-0.76%, -0.15%]
64 packages / 1 present reinstall name 72.9 → 72.7 ms -0.32% [-0.78%, +0.11%] 34.96 → 35.00 MiB +0.09% [-0.18%, +0.37%]
64 packages / 2 present reinstall names 72.9 → 73.3 ms +0.59% [-0.46%, +1.85%] 35.05 → 35.02 MiB -0.08% [-0.29%, +0.11%]
2,048 packages / 1 absent reinstall name 358.5 → 355.6 ms -0.82% [-1.44%, -0.23%] 59.08 → 59.02 MiB -0.10% [-0.24%, +0.03%]
2,048 packages / 1,024 present reinstall names 441.2 → 426.3 ms -3.37% [-5.14%, -1.42%] 101.46 → 100.92 MiB -0.53% [-3.06%, +2.20%]
2,048 packages / 1,024 absent reinstall names 365.1 → 359.6 ms -1.51% [-2.26%, -0.68%] 59.55 → 59.62 MiB +0.11% [-0.07%, +0.28%]
1 package / 1,024 absent reinstall names 65.5 → 65.8 ms +0.50% [-0.44%, +1.58%] 34.16 → 34.00 MiB -0.46% [-0.75%, -0.22%]

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

On the 2,048-package graph, the 1,024-name present and absent selections take 3.4% and 1.5% less time, respectively; the single absent-name control takes 0.8% less time. The other four runtime intervals include zero, including the one-package construction-cost control. All three large-graph peak-RSS intervals include zero. The empty-selection and one-package controls use about 0.16 MiB less peak RSS; the other small-case RSS intervals include zero. These results cover complete dry-run planning and do not measure actual reinstallation. RSS is Hyperfine's Linux wait4 peak, not an allocation count or summed simultaneous process-tree memory.

Existing component benchmarks

The reinstall_membership benchmark isolates owned-index lookup, borrowed-index construction and lookup, and the linear Reinstall::contains_package reference. It covers small selections, hits, misses, and construction costs; the quadratic reference is capped for instrumented runs. These are membership component clocks, not measurements of Exclusions, Planner::build, or complete install commands.

@zaniebot zaniebot added the build:skip-docker Skip Docker builds for this pull request label Jul 16, 2026
@zaniebot zaniebot closed this Jul 16, 2026
@zaniebot zaniebot reopened this Jul 16, 2026
@astral-automations-bot
astral-automations-bot Bot force-pushed the zb/bughuntperf/251-reinstall-membership branch 2 times, most recently from 11a925f to 60e5321 Compare July 30, 2026 20:28
@astral-automations-bot
astral-automations-bot Bot force-pushed the zb/bughuntperf/251-reinstall-membership branch from 60e5321 to 8c28b8d Compare August 11, 2026 17:28
@astral-automations-bot
astral-automations-bot Bot force-pushed the zb/bughuntperf/251-reinstall-membership branch from 8c28b8d to 12d7579 Compare August 27, 2026 15:29
@zaniebot zaniebot added priority:3 Normal: useful features, documentation, usability, or routine efficiency improvements. size:2 Moderate: one subsystem with meaningful invariants, edge cases, or operational evidence to inspect. performance risk:1 Negligible risk of localized mistakes that are obvious and easy to correct. labels Sep 9, 2026
@astral-automations-bot
astral-automations-bot Bot force-pushed the zb/bughuntperf/251-reinstall-membership branch from 12d7579 to 6b0ecd2 Compare September 28, 2026 21:35
@codspeed

codspeed Bot commented Sep 28, 2026 •

Copy link
Copy Markdown

Merging this PR will not alter performance

✅ 54 untouched benchmarks
🆕 54 new benchmarks
⏩ 35 skipped benchmarks1

Performance Changes

Mode Benchmark BASE HEAD Efficiency
🆕 Simulation build-borrowed[1] N/A 3.9 µs N/A
🆕 Simulation build-borrowed[1024] N/A 147.5 µs N/A
🆕 Simulation build-borrowed[2] N/A 4 µs N/A
🆕 Simulation build-borrowed[256] N/A 40.7 µs N/A
🆕 Simulation build-borrowed[4096] N/A 593.1 µs N/A
🆕 Simulation build-borrowed[64] N/A 15.1 µs N/A
🆕 Simulation build-borrowed[8] N/A 5.2 µs N/A
🆕 Simulation build-owned[1] N/A 4.4 µs N/A
🆕 Simulation build-owned[1024] N/A 189.8 µs N/A
🆕 Simulation build-owned[2] N/A 4.6 µs N/A
🆕 Simulation build-owned[256] N/A 49.4 µs N/A
🆕 Simulation build-owned[4096] N/A 771.2 µs N/A
🆕 Simulation build-owned[64] N/A 17.6 µs N/A
🆕 Simulation build-owned[8] N/A 5.9 µs N/A
🆕 Simulation linear-hit[1] N/A 758.2 ns N/A
🆕 Simulation linear-hit[1024] N/A 14.9 ms N/A
🆕 Simulation linear-hit[2] N/A 1 µs N/A
🆕 Simulation linear-hit[256] N/A 759.2 µs N/A
🆕 Simulation linear-hit[64] N/A 53.1 µs N/A
🆕 Simulation linear-hit[8] N/A 2.6 µs N/A
... ... ... ... ... ...

ℹ️ Only the first 20 benchmarks are displayed. Go to the app to view all benchmarks.


Comparing zb/bughuntperf/251-reinstall-membership (da2bcf8) with main (d644be2)

Open in CodSpeed

Footnotes

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

@astral-automations-bot
astral-automations-bot Bot force-pushed the zb/bughuntperf/251-reinstall-membership branch 2 times, most recently from c6490be to da2bcf8 Compare October 1, 2026 22:56
@zaniebot zaniebot added the build:skip-release Disable building release binaries for a pull request label Oct 7, 2026
@astral-automations-bot
astral-automations-bot Bot force-pushed the zb/bughuntperf/251-reinstall-membership branch from da2bcf8 to 02e18de Compare October 18, 2026 04:17
Comment on lines +2197 to +2201
success: true
exit_code: 0
----- stdout -----

----- stderr -----

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[P2] Update the snapshot to the current output format

uv_test::run_and_format emits exit_code: 0 (success) and omits empty stdout, so this snapshot cannot match even when reinstallation succeeds. Regenerate this snapshot using the current formatter, matching the neighboring snapshots.

fs-err = { workspace = true }
futures = { workspace = true }
jiff = { workspace = true }
rmp-serde = { workspace = true }

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[P2] Remove the unused rmp-serde dependency

No source or benchmark in uv-bench uses rmp-serde. This adds an unused dependency that the configured cargo-shear --deny-warnings CI check will flag. Remove this declaration and its corresponding uv-bench dependency entry in Cargo.lock.

Comment on lines +1 to +2
use std::hint::black_box;
use std::str::FromStr;

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[P3] Use uv's allocator in the construction benchmarks

The planner-* and build-* measurements include allocating and dropping hash sets, but this benchmark does not link uv_performance_memory_allocator. Consequently, it measures the system allocator instead of uv's jemalloc on Linux or mimalloc on Windows, affecting the construction cost compared with the allocation-free linear control. Add the same extern crate uv_performance_memory_allocator declaration used by neighboring allocation-sensitive benchmarks.

This branch was successfully deployed

1 active deployment
automations — 02e18de3 Deployed Oct 18, 2026 by astral-automations-bot[bot] via review-code-quality / report #10945
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

build:skip-docker Skip Docker builds for this pull request build:skip-release Disable building release binaries for a pull request performance priority:3 Normal: useful features, documentation, usability, or routine efficiency improvements. risk:1 Negligible risk of localized mistakes that are obvious and easy to correct. size:2 Moderate: one subsystem with meaningful invariants, edge cases, or operational evidence to inspect.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants