Skip to content

perf(pm): prioritize install clone pumping#2992

Draft
elrrrrrrr wants to merge 1 commit into
exp/pm-install-clone-batch-completionsfrom
exp/pm-install-pump-clones-before-extracts
Draft

perf(pm): prioritize install clone pumping#2992
elrrrrrrr wants to merge 1 commit into
exp/pm-install-clone-batch-completionsfrom
exp/pm-install-pump-clones-before-extracts

Conversation

@elrrrrrrr
Copy link
Copy Markdown
Contributor

@elrrrrrrr elrrrrrrr commented May 19, 2026

Summary

This is an independent p3 scheduler experiment on top of #2989.

The install scheduler currently pumps ready work in this order:

  1. downloads
  2. extracts
  3. clones/materialize

When p3 has both extracted packages and ready clone placements, new extract workers can enter the global rayon queue before materialize workers. This PR keeps network prefetch first, but gives ready clone/materialize work a chance to enter rayon before starting more cache writes.

Hypothesis

  • p3 may improve if clone/materialize critical-path work is less often queued behind extract/cache-write work.
  • p4 should be neutral because warm link has no extract queue.
  • If p3 regresses, it means keeping extract/cache writes fully ahead of materialize is better for this workload.

Validation

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

Bench Result

GHA Linux npmjs run 26093648834:

phase utoo wall vCtx iCtx
p3 cold install 6.22s 56.8K 36.5K
p4 warm link 1.93s 7.4K 4.4K

p4 is a no-op control for this PR because there is no extract queue in warm link, so its movement is GHA noise. p3 regressed versus #2989 latest npmjs reference (5.29s, 53.0K/32.9K).

Conclusion: reject for now. Pure pump-order priority does not look like the right p3 fix.

@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 reorders the execution of pump_clones and pump_extracts within the SchedulerState::run loop in crates/pm/src/service/install_scheduler.rs. This change prioritizes network prefetch and materialization work before starting cache writes. There are no review comments to address, and I have no further feedback to provide.

@github-actions
Copy link
Copy Markdown

📊 pm-bench-phases · d374339 · 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.53s 0.18s 10.31s 10.53s 590M 291.1K
utoo-next 8.94s 1.14s 10.49s 12.81s 988M 119.8K
utoo-npm 9.40s 1.87s 10.83s 12.98s 1002M 124.3K
utoo 7.73s 0.08s 11.22s 11.59s 934M 147.9K
PM vCtx iCtx netRX netTX cache node_mod lock
bun 19.6K 17.9K 1.19G 7M 1.84G 1.73G 1M
utoo-next 137.5K 98.5K 1.16G 5M 1.71G 1.70G 2M
utoo-npm 147.6K 106.4K 1.16G 6M 1.71G 1.70G 2M
utoo 77.0K 50.9K 1.16G 6M 1.71G 1.70G 2M

p1_resolve

PM wall ±σ user sys RSS pgMinor
bun 2.58s 0.01s 3.89s 1.17s 498M 188.8K
utoo-next 3.30s 0.08s 5.48s 2.27s 613M 82.0K
utoo-npm 3.37s 0.03s 5.63s 2.27s 624M 80.4K
utoo 2.49s 0.04s 6.03s 1.79s 648M 123.7K
PM vCtx iCtx netRX netTX cache node_mod lock
bun 13.9K 3.3K 202M 3M 107M - 1M
utoo-next 82.0K 88.7K 200M 3M 7M 3M 2M
utoo-npm 83.0K 90.7K 200M 3M 7M 3M 2M
utoo 17.5K 20.3K 202M 3M 7M 3M 2M

p3_cold_install

PM wall ±σ user sys RSS pgMinor
bun 6.80s 0.21s 6.33s 10.49s 570M 199.3K
utoo-next 8.22s 1.11s 5.08s 11.35s 442M 59.9K
utoo-npm 7.36s 1.71s 5.23s 11.25s 489M 62.1K
utoo 5.57s 0.12s 4.84s 9.64s 485M 62.0K
PM vCtx iCtx netRX netTX cache node_mod lock
bun 7.2K 8.7K 1019M 5M 1.76G 1.76G 1M
utoo-next 123.0K 52.9K 990M 3M 1.70G 1.70G 3M
utoo-npm 115.2K 55.0K 990M 3M 1.70G 1.70G 3M
utoo 52.1K 34.7K 989M 2M 1.70G 1.70G 3M

p4_warm_link

PM wall ±σ user sys RSS pgMinor
bun 3.23s 0.14s 0.20s 2.32s 134M 32.5K
utoo-next 2.48s 0.45s 0.49s 3.85s 79M 18.4K
utoo-npm 2.38s 0.12s 0.50s 3.78s 79M 18.7K
utoo 2.10s 0.13s 0.34s 3.35s 50M 11.3K
PM vCtx iCtx netRX netTX cache node_mod lock
bun 390 22 5M 57K 1.91G 1.75G 1M
utoo-next 40.9K 17.6K 1K 4K 1.70G 1.70G 2M
utoo-npm 42.1K 19.2K 2K 5K 1.70G 1.70G 2M
utoo 7.6K 4.4K 3K 9K 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