Skip to content

Read installed wheel sidecars concurrently - #1446

Draft
zaniebot wants to merge 2 commits into
zb/fs-io-prune-source-cachefrom
zb/fs-io-index-installed
Draft

zaniebot wants to merge 2 commits into
zb/fs-io-prune-source-cachefrom
zb/fs-io-index-installed

Conversation

@zaniebot

@zaniebot zaniebot commented Sep 11, 2026 •

Copy link
Copy Markdown
Collaborator

Large site-packages indexes read several optional sidecars for each installed wheel in sequence. Read eligible .dist-info entries in bounded batches on the configured installer thread pool once an index contains at least 1,024 wheels. Smaller indexes and explicitly single-threaded runs remain serial so metadata-only commands do not pay unnecessary pool-startup cost. A staged sidecar reader lets conversion, diagnostics, first-error handling, legacy entries, and index insertion remain in sorted path order. METADATA and WHEEL are still read lazily.

Hyperfine 2.0.0 measurements of 45aab588c → 7f4243496 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 list --format json --python VENV_PYTHON, with --offline --no-config --color never --cache-dir CACHE. UV_CONCURRENT_INSTALLS=4 sets the installer pool width, except for the one-worker control, which uses UV_CONCURRENT_INSTALLS=1. Output went to /dev/null.

The synthetic virtual environments contain the indicated number of wheel metadata directories. Present-sidecar fixtures include uv_cache.json, uv_build.json, and archive-style direct_url.json; missing fixtures omit all three, and the mixed fixture alternates present and missing records. The 1,023/1,024 cases bracket the parallel-reader threshold. OS page and interpreter-query caches were warm. Each fresh process constructs the installed-package index and renders JSON, including installer-pool startup when the parallel path is enabled.

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
Missing sidecars, 100 packages 18.6 → 17.7 ms -4.96% [-12.62%, +0.81%] 23.00 → 22.86 MiB -0.64% [-0.97%, -0.29%]
Missing sidecars, 1,023 packages 37.0 → 37.1 ms +0.13% [-0.63%, +0.92%] 24.32 → 24.25 MiB -0.27% [-0.58%, +0.00%]
Missing sidecars, 1,024 packages 36.4 → 29.2 ms -19.91% [-21.28%, -18.68%] 24.36 → 24.69 MiB +1.37% [+1.03%, +1.71%]
Missing sidecars, 5,000 packages 117.9 → 75.0 ms -36.37% [-37.02%, -35.66%] 30.65 → 31.38 MiB +2.39% [+1.93%, +2.83%]
Present sidecars, 100 packages 23.1 → 23.4 ms +1.53% [-0.33%, +3.58%] 23.43 → 23.40 MiB -0.13% [-0.54%, +0.29%]
Present sidecars, 1,023 packages 93.1 → 86.0 ms -7.67% [-20.60%, +0.80%] 25.23 → 25.24 MiB +0.03% [-0.20%, +0.30%]
Present sidecars, 1,024 packages 85.8 → 44.3 ms -48.35% [-48.72%, -47.95%] 25.20 → 26.29 MiB +4.33% [+3.86%, +4.82%]
Present sidecars, 5,000 packages 350.1 → 148.1 ms -57.70% [-58.07%, -57.29%] 32.71 → 34.40 MiB +5.16% [+4.54%, +5.75%]
Mixed sidecars, 5,000 packages 236.6 → 114.5 ms -51.61% [-52.39%, -50.76%] 31.62 → 33.23 MiB +5.10% [+4.50%, +5.75%]
Present sidecars, 5,000 packages (one worker) 350.3 → 359.3 ms +2.59% [+0.05%, +6.00%] 32.81 → 32.71 MiB -0.32% [-0.63%, +0.03%]

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.

The five parallel-reader cases take 19.9–57.7% less time and use about 0.33–1.69 MiB more peak RSS (1.4–5.2%). The one-worker control takes 2.6% more time, with a 95% interval from 0.05% to 6.00%; all four below-threshold runtime intervals include zero. The 100-package missing-sidecar control uses about 0.15 MiB less peak RSS, while the other control RSS intervals include zero. These warm-filesystem results show large runtime reductions on the parallel path, a peak-memory increase, and a smaller regression in the one-worker control. RSS is Hyperfine's Linux wait4 peak, not an allocation count or summed simultaneous process-tree memory.

Earlier command and component measurements

The installed_package_sidecars wall-time benchmark compares b1dd047e with this pull's 7f424349. Entries are Criterion medians in milliseconds, with 95% confidence intervals.

Sidecars Packages Baseline ms [95% CI] Candidate ms [95% CI] Observed change
Missing 50 1.202 [1.194, 1.224] 1.204 [1.197, 1.221] +0.17%
Missing 500 12.119 [11.954, 12.234] 12.441 [12.359, 12.545] +2.65%
Missing 2,000 50.441 [49.690, 53.082] 15.925 [15.673, 16.857] -68.43%
Present 50 3.540 [3.515, 3.561] 3.584 [3.556, 3.617] +1.25%
Present 500 35.900 [35.712, 36.223] 37.175 [36.870, 38.019] +3.55%
Present 2,000 146.792 [146.342, 147.150] 36.949 [36.295, 37.364] -74.83%

Fresh-process uv pip list --format json measurements include process and thread-pool startup. The same revisions were measured on the real 93-package Jupyter environment from test/requirements/compiled/jupyter.txt, and on valid 1,024-package fixtures at the parallelism boundary.

Fresh-process workload Baseline ms [≥95% CI] Candidate ms [≥95% CI] Observed change
Jupyter, default concurrency 20.703 [20.023, 21.243] 20.422 [19.834, 20.922] -1.36%
Jupyter, UV_CONCURRENT_INSTALLS=1 19.771 [19.658, 20.158] 20.077 [19.855, 20.710] +1.55%
1,024 packages, missing sidecars 48.382 [47.442, 49.586] 41.574 [39.902, 42.256] -14.07%
1,024 packages, present sidecars 109.865 [108.324, 111.120] 48.753 [45.304, 51.042] -55.62%

Both comparisons used Linux 5.15.0-1110-azure, x86-64/ext4, 16 logical AMD EPYC 9V74 CPUs, Rust 1.98.1 profiling builds, locked dependencies, CPython 3.12.13, and warm filesystem state. Criterion used 10 samples, a one-second warmup, and a two-second requested measurement window. Fresh-process rows use 12 balanced runs per revision/configuration; their intervals use the third and tenth sorted observations, giving 96.14% coverage for the median. Reproduce the library comparison with cargo bench --locked --profile profiling -p uv-bench --bench fs_metadata -- installed_package_sidecars --sample-size 10 --warm-up-time 1 --measurement-time 2.

The merge case is a 68–75% reduction for the 2,000-package cases and a fresh-process improvement at the 1,024-package cutoff. The serial 500-package cases are 2.7–3.6% slower on this host; the small Jupyter differences are not evidence of a meaningful change. The cutoff keeps the large-index benefit without imposing pool startup on ordinary small environments.

@zaniebot zaniebot added risk:3 Credible risk of meaningful incorrect behavior or regression; bounded or recoverable. 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. labels Sep 11, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

performance priority:3 Normal: useful features, documentation, usability, or routine efficiency improvements. risk:3 Credible risk of meaningful incorrect behavior or regression; bounded or recoverable. 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