Skip to content

Benchmark wheel unlink backends - #1602

Draft
zaniebot wants to merge 2 commits into
zb/fs-io-cache-key-comparisonsfrom
zb/fs-io-wheel-record-unlinks
Draft

zaniebot wants to merge 2 commits into
zb/fs-io-cache-key-comparisonsfrom
zb/fs-io-wheel-record-unlinks

Conversation

@zaniebot

@zaniebot zaniebot commented Sep 12, 2026 •

Copy link
Copy Markdown
Collaborator

Uninstalling an installed wheel walks its RECORD and removes each path before cleaning up empty directories. Wheels with many small files can spend a substantial part of uv sync, uv pip install --reinstall, or uv pip uninstall in this work. Add an opt-in wheel_record_unlinks benchmark to compare ordinary removal, bounded worker pools, and Linux io_uring UNLINKAT, alongside the complete production uninstall_wheel call. Production uninstall behavior is unchanged.

Each operation receives a newly copied, independently owned installation tree. The fixtures retain the source wheel hash, installed RECORD order, file contents and modes, and a separate full-uninstall reference. The leaf backends attempt every independent path and return ordered outcomes; they deliberately do not claim production's partial-error precedence, recursive-directory fallback, or directory-cleanup semantics. The ordinary and worker controls are portable. Ring code is enabled for Linux x86_64, aarch64, riscv64, loongarch64, and powerpc64, with runtime opcode and disposable-file probes. An unavailable ring is omitted, not replaced by an ordinary-I/O timing.

An initial ordinary-I/O census established the workload's scale:

Copy-mode wheel Installed RECORD leaves Direct parent directories Full uv pip uninstall median, ms
Repacked cached JupyterLab 4.0.11 794 106 67.096
Synthetic manyfiles 10,007 2 426.051

These are three-process warm-filesystem medians on x86-64 GNU/Linux 5.15 and ext4, using a locked profiling build. The JupyterLab input is a byte-verified repack of cached wheel contents, not the original publisher ZIP. The census measures the whole command and is not an io_uring result or a denominator for the benchmark's narrower leaf timer.

The leaf comparisons reuse an initialized worker pool or ring. They include per-operation dispatch and completion, but exclude fixture reconstruction, warmup, backend/thread setup and teardown, and the final-tree oracle. The complete uninstall_wheel row includes RECORD parsing and directory cleanup, but not CLI startup or installed-package indexing. Backends receive identical installed templates within each process; the installed-manifest identity is recorded separately for every process.

The following exploratory screen used the benchmark at 4a12fd86 (the measured implementation is unchanged at f57a3ecf), a locked profiling build with Rust 1.98.1, and an AMD EPYC 9V74 host with 16 available CPUs, Linux 5.15.0-1110-azure, and ext4. These timings cover x86_64 only; the other supported Linux architectures and macOS/Windows controls have not been performance-measured here. The io-wq column reports observed bounded/unbounded worker limits.

Exploratory selection from two mirrored fresh processes per row, with ten Criterion sample groups each. The pooled median uses all 20 normalized group averages. Brackets are each process's conditional 95% Criterion interval, not a pooled process-level confidence interval. Filesystem state is warm.

Repacked cached JupyterLab 4.0.11 (794 leaves; 106 direct parents):

Backend Pooled median, ms Round 1, ms [95% CI] Round 2, ms [95% CI] Observed io-wq limits
ordinary 31.237 30.909 [30.802, 31.090] 31.693 [31.339, 32.148] —
workers-1 32.026 32.253 [31.760, 32.466] 31.827 [31.534, 32.209] —
workers-4 9.447 9.388 [8.886, 9.928] 9.554 [9.131, 10.162] —
workers-16 7.182 7.143 [6.515, 8.393] 7.307 [6.858, 8.125] —
io-uring-1 48.163 49.234 [47.536, 52.537] 47.835 [47.701, 48.958] 1/1048576
io-uring-16 16.999 16.569 [16.290, 17.638] 17.246 [16.672, 18.665] 16/1048576
io-uring-64 14.460 14.447 [14.149, 14.965] 14.460 [13.898, 14.985] 64/1048576
io-uring-256 13.838 14.127 [13.581, 14.447] 13.565 [13.408, 14.058] 64/1048576
Complete uninstall_wheel 41.257 41.098 [40.671, 41.408] 41.406 [41.175, 42.099] —

The lowest pooled worker median is workers-16; the lowest ring median is io-uring-256.

Synthetic manyfiles (10,007 leaves; 2 direct parents):

Backend Pooled median, ms Round 1, ms [95% CI] Round 2, ms [95% CI] Observed io-wq limits
ordinary 302.551 301.812 [300.744, 305.623] 304.829 [301.904, 310.327] —
workers-1 303.106 303.106 [300.664, 309.729] 304.076 [300.720, 309.544] —
workers-4 197.866 198.238 [192.998, 204.240] 197.193 [194.379, 206.210] —
workers-16 232.579 232.604 [229.264, 234.519] 232.521 [227.290, 235.141] —
io-uring-1 512.941 512.957 [505.606, 533.657] 512.941 [507.306, 517.047] 1/1048576
io-uring-16 231.611 228.679 [224.866, 234.600] 237.790 [226.409, 255.033] 16/1048576
io-uring-64 207.441 206.019 [203.816, 208.605] 212.329 [207.118, 220.679] 64/1048576
io-uring-256 199.623 199.945 [196.784, 205.291] 198.710 [193.402, 207.161] 64/1048576
Complete uninstall_wheel 331.239 329.440 [327.860, 336.234] 331.905 [329.937, 334.194] —

The lowest pooled worker median is workers-4; the lowest ring median is io-uring-256.

The complete-uninstall row includes RECORD parsing and directory cleanup; the leaf rows do not. Their difference is not an additive predicted CLI speedup. This screen does not change production dispatch.

On the real-wheel fixture, the best portable pool takes 7.182 ms versus 13.838 ms for the best ring. On the synthetic fixture, the best ring has no measured advantage over the four-worker control (199.623 ms versus 197.866 ms). Neither fixture supports a production io_uring follow-up on this host. The portable-worker result is a useful lead for users reinstalling or removing file-heavy packages, but it is not yet an end-to-end speedup.

Merge the benchmark to retain this comparison and make future kernel, filesystem, and portable-concurrency changes measurable without changing uninstall behavior. Any production proposal still needs setup-inclusive measurements, a representative full-command improvement over the best portable control, and an explicit partial-failure policy.

@astral-automations-bot astral-automations-bot Bot added area:benchmarks Related to benchmarking internal A refactor or improvement that is not user-facing labels Sep 12, 2026
@zaniebot
zaniebot added this pull request to stack #1448 September 12, 2026 06:29
@zaniebot zaniebot added risk:2 Low, contained risk of minor incorrect behavior with straightforward recovery. priority:4 Low: worthwhile tests, refactors, or maintenance with modest immediate benefit. size:4 Complex: architectural or security-sensitive work requiring broad or cross-repository context. labels Sep 12, 2026
@zaniebot zaniebot added the build:skip-release Disable building release binaries for a pull request label Oct 7, 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

area:benchmarks Related to benchmarking build:skip-release Disable building release binaries for a pull request internal A refactor or improvement that is not user-facing priority:4 Low: worthwhile tests, refactors, or maintenance with modest immediate benefit. risk:2 Low, contained risk of minor incorrect behavior with straightforward recovery. size:4 Complex: architectural or security-sensitive work requiring broad or cross-repository context.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants