Skip to content

Avoid repeated root requirement fork-marker unions - #246

Draft
zaniebot wants to merge 1 commit into
mainfrom
zb/bughuntperf/225-root-fork-markers
Draft

zaniebot wants to merge 1 commit into
mainfrom
zb/bughuntperf/225-root-fork-markers

Conversation

@zaniebot

@zaniebot zaniebot commented Jul 16, 2026 •

Copy link
Copy Markdown
Collaborator

Lockfile export, tree construction, and workspace metadata can rebuild the same PEP 508 fork-marker union for every root or dependency-group requirement that selects a split package. Repeated requirements therefore repeat work that depends only on the selected locked package.

Index the needed root packages by name and cache each candidate’s combined fork marker for reuse in root matching and metadata reachability. Different versions remain separate, and packages without fork markers remain unconditional.

Hyperfine 2.0.0 measurements of a3eb76f85 → 60307726f 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.

uv export, universal JSON uv tree, and uv workspace metadata read synthetic frozen script locks. Each lock contains distinct root requirements for one package name. In split cases, the listed fork width applies separately to versions 1 and 2; version 3 has one complementary marker for other platforms. The controls use one unconditional package without fork markers. Each command starts a fresh process, without new resolution. OS pages and interpreter-query caches are warm. Both revisions read the same frozen lock.

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
uv export / 1 root requirement / 1 fork marker each for versions 1 and 2 18.0 → 20.1 ms +12.19% [-0.05%, +30.73%] 26.52 → 26.28 MiB -0.94% [-1.41%, -0.50%]
uv export / 8 root requirements / 16 fork markers each for versions 1 and 2 27.4 → 27.1 ms -1.04% [-5.57%, +3.94%] 29.93 → 29.62 MiB -1.06% [-1.44%, -0.70%]
uv export / 128 root requirements / 16 fork markers each for versions 1 and 2 144.2 → 174.1 ms +20.72% [-0.57%, +47.62%] 70.32 → 70.12 MiB -0.28% [-0.48%, -0.08%]
uv export / 512 root requirements / 16 fork markers each for versions 1 and 2 586.0 → 616.4 ms +5.17% [-5.47%, +17.90%] 191.51 → 191.34 MiB -0.09% [-0.17%, -0.01%]
uv export / 512 root requirements / 64 fork markers each for versions 1 and 2 5,158.9 → 5,138.1 ms -0.40% [-5.50%, +4.00%] 1,745.81 → 1,745.44 MiB -0.02% [-0.03%, -0.01%]
uv export / 128 root requirements / 256 fork markers each for versions 1 and 2 20,101.1 → 20,155.1 ms +0.27% [-2.87%, +3.09%] 5,762.06 → 5,761.56 MiB -0.01% [-0.01%, -0.004%]
uv tree / 512 root requirements / 64 fork markers each for versions 1 and 2 941.7 → 944.5 ms +0.30% [-5.51%, +6.22%] 125.03 → 125.10 MiB +0.05% [-0.03%, +0.14%]
uv workspace metadata / 512 root requirements / 64 fork markers each for versions 1 and 2 1,776.0 → 1,786.7 ms +0.61% [-3.78%, +6.11%] 116.27 → 116.27 MiB +0.00% [-0.11%, +0.09%]
uv export / 512 root requirements / unconditional package / no fork markers 22.3 → 22.8 ms +2.32% [-9.42%, +18.70%] 27.04 → 26.72 MiB -1.20% [-1.63%, -0.81%]
uv workspace metadata / 512 root requirements / unconditional package / no fork markers 22.2 → 23.9 ms +7.73% [-0.87%, +16.94%] 27.01 → 27.08 MiB +0.25% [+0.06%, +0.46%]

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.

All ten elapsed-time intervals include zero, so this study does not establish an elapsed-time change for these workloads. Seven export cases show peak RSS reductions of about 0.17–0.50 MiB, including the unconditional control; the unconditional metadata case increases by about 0.07 MiB, and the other two RSS intervals include zero. The largest export case uses about 5.6 GiB in both revisions. These are complete-command measurements and do not isolate fork-marker union costs. RSS is Hyperfine's Linux wait4 peak, not an allocation count or summed simultaneous process-tree memory.

@zaniebot
zaniebot force-pushed the zb/bughuntperf/225-root-fork-markers branch from e5ff5bd to 1aa2a43 Compare July 16, 2026 03:15
@astral-automations-bot
astral-automations-bot Bot force-pushed the zb/bughuntperf/225-root-fork-markers branch from 1aa2a43 to ab7a89b Compare July 27, 2026 19:54
@astral-automations-bot
astral-automations-bot Bot force-pushed the zb/bughuntperf/225-root-fork-markers branch from ab7a89b to 3b3fec0 Compare August 18, 2026 15:02
@astral-automations-bot
astral-automations-bot Bot force-pushed the zb/bughuntperf/225-root-fork-markers branch 2 times, most recently from 3d33014 to a72cc8a Compare August 31, 2026 15:05
@zaniebot zaniebot added priority:2 Important: bounded correctness, release reliability, committed work, or proven performance gains. size:3 Substantial: interacting behaviors, difficult compatibility questions, or a careful migration. performance preview Experimental behavior 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/225-root-fork-markers branch from a72cc8a to 46048c8 Compare September 15, 2026 18:22
@codspeed

codspeed Bot commented Sep 15, 2026 •

Copy link
Copy Markdown

Merging this PR will improve performance by ×9.3

⚠️ Different runtime environments detected

Some benchmarks with significant performance changes were compared across different runtime environments,
which may affect the accuracy of the results.

Open the report in CodSpeed to investigate

⚡ 11 improved benchmarks
✅ 43 untouched benchmarks
⏩ 35 skipped benchmarks1

Performance Changes

Mode Benchmark BASE HEAD Efficiency
⚡ WallTime unzip_wheel_many_files 371 ms 12 ms ×31
⚡ WallTime install_wheel_many_files 385 ms 13.6 ms ×28
⚡ WallTime prepare_wheel_many_files 383.4 ms 14.7 ms ×26
⚡ WallTime unpack_sdist_many_files 317.2 ms 36 ms ×8.8
⚡ WallTime resolve_warm_jupyter_universal 87.6 ms 11.7 ms ×7.5
⚡ WallTime resolve_warm_jupyter 17.4 ms 2.4 ms ×7.2
⚡ WallTime discover_workspace_from_all_members_with_excludes 52.7 ms 8.1 ms ×6.5
⚡ WallTime discover_workspace_from_all_members 50.5 ms 7.9 ms ×6.4
⚡ WallTime run_python_version_synthetic_workspace 268.4 ms 42.3 ms ×6.3
⚡ WallTime resolve_warm_airflow 233.2 ms 41.8 ms ×5.6
⚡ WallTime hash_sha256 1,165.6 µs 401.2 µs ×2.9

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/bughuntperf/225-root-fork-markers (6030772) with main (b7c8c62)2

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

  2. No successful run was found on main (ba5833f) during the generation of this report, so b7c8c62 was used instead as the comparison base. There might be some changes unrelated to this pull request in this report. ↩

@astral-automations-bot
astral-automations-bot Bot force-pushed the zb/bughuntperf/225-root-fork-markers branch from 8f32d7b to 6030772 Compare October 3, 2026 00:50

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 preview Experimental behavior priority:2 Important: bounded correctness, release reliability, committed work, or proven performance gains. risk:1 Negligible risk of localized mistakes that are obvious and easy to correct. size:3 Substantial: interacting behaviors, difficult compatibility questions, or a careful migration.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants