perf(pm): clone first waiter after extract#2995
Draft
elrrrrrrr wants to merge 1 commit into
Draft
Conversation
Contributor
There was a problem hiding this comment.
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.
📊 pm-bench-phases ·
|
| 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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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_waiters;Hypothesis
Validation
cargo fmtcargo test -p utoo-pm install_schedulercargo clippy -p utoo-pm --all-targets -- -D warnings --no-depsBench Results
Baseline #2989 integrated head (
fd38cfff):26094747554: p35.30s, ctx52.1K/35.0K; p42.07s, ctx7.5K/4.5K26095851789: p35.66s, ctx54.7K/37.6K; p42.16s, ctx7.8K/4.6KThis PR #2995 (
d1acae9, run26100667673):7.71s, ctx77.8K/50.2K2.52s, ctx17.5K/22.0K5.75s, ctx59.7K/33.9K2.09s, ctx7.6K/4.3KConclusion: 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.