Skip to content

perf(pm): clone first waiter after extract#2995

Draft
elrrrrrrr wants to merge 1 commit into
exp/pm-install-clone-batch-completionsfrom
exp/pm-install-clone-first-after-extract
Draft

perf(pm): clone first waiter after extract#2995
elrrrrrrr wants to merge 1 commit into
exp/pm-install-clone-batch-completionsfrom
exp/pm-install-clone-first-after-extract

Conversation

@elrrrrrrr
Copy link
Copy Markdown
Contributor

@elrrrrrrr elrrrrrrr commented May 19, 2026

Summary

This is a p3 scheduler experiment on top of #2989.

When a tarball download completes, the scheduler already knows which clone placements are waiting for that package. Today extract completes, reports cache readiness to the scheduler, then the scheduler queues clone/materialize work onto rayon. This PR moves the first ready clone waiter into the extract worker:

  • download completion removes one primary clone waiter from download_waiters;
  • extract worker writes the cache and immediately materializes that primary target;
  • extract completion still records the cache and queues remaining waiters normally;
  • if extract fails, the primary and remaining waiters receive the same error;
  • if primary clone fails after cache succeeds, remaining waiters can still use the cache.

Hypothesis

  • p3 may improve by removing one scheduler/rayon handoff per downloaded package with a ready waiter.
  • p4 should be neutral because warm link does not use the extract path.
  • ctx may move either way: fewer clone tasks, but longer extract workers.

Validation

  • cargo fmt
  • cargo test -p utoo-pm install_scheduler
  • cargo clippy -p utoo-pm --all-targets -- -D warnings --no-deps

Bench Results

Baseline #2989 integrated head (fd38cfff):

  • run 26094747554: p3 5.30s, ctx 52.1K/35.0K; p4 2.07s, ctx 7.5K/4.5K
  • full-green run 26095851789: p3 5.66s, ctx 54.7K/37.6K; p4 2.16s, ctx 7.8K/4.6K

This PR #2995 (d1acae9, run 26100667673):

  • p0 7.71s, ctx 77.8K/50.2K
  • p1 2.52s, ctx 17.5K/22.0K
  • p3 5.75s, ctx 59.7K/33.9K
  • p4 2.09s, ctx 7.6K/4.3K

Conclusion: do not integrate for now. p4 is neutral as expected, but p3 does not beat the #2989+#2991 baseline and vCtx increases. The extra coupling between extract and first materialize is not justified by this result.

@elrrrrrrr elrrrrrrr added A-Pkg Manager Area: Package Manager benchmark Run pm-bench on PR labels May 19, 2026
Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request optimizes the package installation process by integrating a primary clone operation directly into the extraction phase. It introduces the ExtractOutcome struct and updates DownloadedPackage and OpDone::Extract to track a primary clone target. By selecting a waiter to be processed immediately after extraction, the scheduler reduces overhead. The changes also include a new helper method take_primary_extract_clone and updated unit tests to verify the concurrent extraction and cloning logic. I have no feedback to provide.

@github-actions
Copy link
Copy Markdown

📊 pm-bench-phases · 7d94cb1 · linux (ubuntu-latest)

Workflow run — ant-design

PMs: utoo (this branch) · utoo-npm (latest published) · bun (latest)

npmjs.org

p0_full_cold

PM wall ±σ user sys RSS pgMinor
bun 9.27s 0.32s 10.41s 10.32s 699M 327.6K
utoo-next 8.24s 0.05s 10.56s 12.29s 963M 130.5K
utoo-npm 7.82s 0.22s 10.78s 12.31s 954M 116.6K
utoo 8.28s 1.14s 11.11s 11.26s 923M 139.1K
PM vCtx iCtx netRX netTX cache node_mod lock
bun 14.9K 18.1K 1.19G 6M 1.84G 1.73G 1M
utoo-next 120.5K 82.0K 1.16G 5M 1.71G 1.70G 2M
utoo-npm 120.7K 82.5K 1.16G 5M 1.71G 1.70G 2M
utoo 79.0K 44.6K 1.16G 6M 1.71G 1.70G 2M

p1_resolve

PM wall ±σ user sys RSS pgMinor
bun 2.03s 0.02s 4.02s 1.03s 511M 166.1K
utoo-next 3.04s 0.06s 5.51s 2.09s 616M 82.0K
utoo-npm 3.06s 0.02s 5.55s 2.13s 604M 81.6K
utoo 2.38s 0.01s 6.05s 1.67s 654M 120.5K
PM vCtx iCtx netRX netTX cache node_mod lock
bun 9.3K 4.3K 203M 3M 107M - 1M
utoo-next 72.5K 88.4K 200M 2M 7M 3M 2M
utoo-npm 72.7K 90.6K 200M 2M 7M 3M 2M
utoo 14.1K 18.2K 202M 3M 7M 3M 2M

p3_cold_install

PM wall ±σ user sys RSS pgMinor
bun 6.74s 0.27s 6.29s 10.01s 601M 205.6K
utoo-next 6.85s 0.54s 5.06s 11.33s 545M 68.2K
utoo-npm 9.12s 2.66s 5.15s 11.52s 477M 58.8K
utoo 5.16s 0.18s 4.85s 9.69s 517M 55.7K
PM vCtx iCtx netRX netTX cache node_mod lock
bun 4.1K 7.0K 1019M 3M 1.76G 1.76G 1M
utoo-next 109.9K 50.6K 988M 3M 1.70G 1.70G 2M
utoo-npm 132.8K 50.1K 988M 3M 1.70G 1.70G 2M
utoo 52.5K 34.3K 988M 2M 1.70G 1.70G 2M

p4_warm_link

PM wall ±σ user sys RSS pgMinor
bun 3.31s 0.01s 0.20s 2.38s 134M 32.7K
utoo-next 2.38s 0.28s 0.48s 3.81s 79M 18.8K
utoo-npm 2.24s 0.08s 0.50s 3.85s 79M 18.2K
utoo 2.07s 0.06s 0.36s 3.31s 50M 11.2K
PM vCtx iCtx netRX netTX cache node_mod lock
bun 262 22 5M 32K 1.91G 1.75G 1M
utoo-next 42.1K 19.1K 1K 6K 1.70G 1.70G 2M
utoo-npm 42.4K 18.9K 1K 5K 1.70G 1.70G 2M
utoo 7.4K 4.3K 2K 6K 1.71G 1.70G 2M

npmmirror.com: no output captured.

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

Labels

A-Pkg Manager Area: Package Manager benchmark Run pm-bench on PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant