Repository navigation
fix(install): bound and speed up dedicated workspace installs - #16986
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info
📝 Walkthrough
Merge Risk: ⚪ Minimal · up to
|
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #16986 +/- ##
==========================================
- Coverage 92.60% 92.60% -0.01%
==========================================
Files 1766 1769 +3
Lines 227044 227477 +433
==========================================
+ Hits 210259 210653 +394
- Misses 16785 16824 +39 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Same-run regression checkHEAD and main are measured on the same runner. The tolerance is 5% of the main median or 2 ms, whichever is larger. A regression requires both the median slowdown and the gap between the fastest retained HEAD sample and slowest retained main sample to exceed this tolerance, after trimming up to 10% from each tail. Suspected regressions are rerun once with target order reversed and only fail if reproduced. This conservative noise guard is not a statistical confidence interval. Inconclusive rows do not fail the check. They remain visible for performance review. Bencher retains absolute minimum timings for historical tracking; historical alerts do not gate this PR. Sequential measurements can still be affected by runner drift.
Integrated-Benchmark Report (Linux)Commit: Regular scenarios report direct and pnpr installs. The peer-heavy resolver scenario compares current Rust, main Rust, and TypeScript pnpm; the linked and injected workspace scenarios compare current Rust against main Rust. Bencher consumes pacquet@HEAD and pnpr@HEAD. The tables below show mean ± σ. Bencher tracks absolute minimum latency; PR regression checks compare HEAD and main samples from the same runner. Historical timing alerts do not gate PRs. Scenario: Isolated linker: fresh restore, cold cache + cold store
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 2.4752946753200002,
"stddev": 0.12175827098874947,
"median": 2.44262698052,
"user": 1.7310077199999998,
"system": 1.6798959,
"min": 2.3422294800200003,
"max": 2.7100131530200002
},
{
"command": "pacquet@main",
"mean": 2.5062548058200003,
"stddev": 0.11236464663531295,
"median": 2.4751488530200003,
"user": 1.63465922,
"system": 1.6734441999999998,
"min": 2.36140853402,
"max": 2.69126733002
},
{
"command": "pnpr@HEAD",
"mean": 1.56000577392,
"stddev": 0.12288115127546481,
"median": 1.51433216952,
"user": 1.6996292199999998,
"system": 1.6414784,
"min": 1.39549862202,
"max": 1.72965925702
},
{
"command": "pnpr@main",
"mean": 1.43598998712,
"stddev": 0.12140675857975099,
"median": 1.40517368702,
"user": 1.31745502,
"system": 1.3005974,
"min": 1.30619192402,
"max": 1.66370195602
}
]
}Scenario: Isolated linker: fresh restore, hot cache + hot store
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 0.25605205988,
"stddev": 0.01356068095072348,
"median": 0.25213289358,
"user": 0.29668062,
"system": 0.61411854,
"min": 0.23526662558,
"max": 0.28192681658
},
{
"command": "pacquet@main",
"mean": 0.25486365298,
"stddev": 0.03094909433621936,
"median": 0.25535968258,
"user": 0.30230011999999995,
"system": 0.58837374,
"min": 0.21171968258,
"max": 0.30905378158
},
{
"command": "pnpr@HEAD",
"mean": 0.30028998498000004,
"stddev": 0.019703846748896817,
"median": 0.29772180908,
"user": 0.33144852,
"system": 0.66861634,
"min": 0.28223459458000005,
"max": 0.35313955858
},
{
"command": "pnpr@main",
"mean": 0.32191059278000006,
"stddev": 0.03292188340581279,
"median": 0.31197753758,
"user": 0.36927112,
"system": 0.68245084,
"min": 0.28028780458,
"max": 0.38500496458000005
}
]
}Scenario: Isolated linker: repeat install, hot cache + hot store
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 0.009935985624435798,
"stddev": 0.0011650406972139025,
"median": 0.010036502640000002,
"user": 0.005418109416342413,
"system": 0.005410053696498057,
"min": 0.00768257364,
"max": 0.013032368640000002
},
{
"command": "pacquet@main",
"mean": 0.011357520901261272,
"stddev": 0.0017935530872998987,
"median": 0.011116033640000002,
"user": 0.006434001981981983,
"system": 0.0059095018018018005,
"min": 0.008128443640000002,
"max": 0.02071834764
},
{
"command": "pnpr@HEAD",
"mean": 0.01079388526857143,
"stddev": 0.0012525168087093865,
"median": 0.010766927640000002,
"user": 0.006130982857142857,
"system": 0.005601150857142859,
"min": 0.00854118864,
"max": 0.01561167164
},
{
"command": "pnpr@main",
"mean": 0.010806909579024396,
"stddev": 0.0011184037592460836,
"median": 0.01064025364,
"user": 0.006093796422764227,
"system": 0.005658423577235773,
"min": 0.00886290464,
"max": 0.01578042864
}
]
}Scenario: Isolated linker: repeat install, cold cache + hot store
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 0.013602361120412377,
"stddev": 0.002984408593362441,
"median": 0.01313601144,
"user": 0.007276123298969073,
"system": 0.007449120721649482,
"min": 0.00878104694,
"max": 0.02378279494
},
{
"command": "pacquet@main",
"mean": 0.013110639033137257,
"stddev": 0.0020302043937907434,
"median": 0.01259092094,
"user": 0.007946483921568628,
"system": 0.006237160784313731,
"min": 0.00997958194,
"max": 0.02069324494
},
{
"command": "pnpr@HEAD",
"mean": 0.013922195158750008,
"stddev": 0.0029844900148008834,
"median": 0.013395924940000001,
"user": 0.008158562812499997,
"system": 0.006937385156249998,
"min": 0.00938649594,
"max": 0.02440599594
},
{
"command": "pnpr@main",
"mean": 0.01345884894480769,
"stddev": 0.0023305160654215644,
"median": 0.01285203644,
"user": 0.007740184807692308,
"system": 0.006828009519230769,
"min": 0.00981449094,
"max": 0.02060638994
}
]
}Scenario: Isolated linker: fresh install, cold cache + cold store
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 2.77445751446,
"stddev": 0.23808208398747047,
"median": 2.66741501016,
"user": 2.5826740999999993,
"system": 2.0344019600000003,
"min": 2.55980540966,
"max": 3.27935255666
},
{
"command": "pacquet@main",
"mean": 2.64824509636,
"stddev": 0.08805518990219967,
"median": 2.63855037716,
"user": 2.2838008,
"system": 1.77989636,
"min": 2.53705411966,
"max": 2.80918307866
},
{
"command": "pnpr@HEAD",
"mean": 1.63597716596,
"stddev": 0.1145913187103537,
"median": 1.65253428866,
"user": 1.3987966,
"system": 1.53436386,
"min": 1.43874578766,
"max": 1.81098403366
},
{
"command": "pnpr@main",
"mean": 1.56940987756,
"stddev": 0.1191292248650207,
"median": 1.5144239271600002,
"user": 1.3416622,
"system": 1.36331726,
"min": 1.42275087066,
"max": 1.73981436066
}
]
}Scenario: Isolated linker: fresh install, hot cache + hot store
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 0.5298573297000001,
"stddev": 0.04555688792693264,
"median": 0.5323263922,
"user": 0.76536752,
"system": 0.8106204,
"min": 0.4528975672000001,
"max": 0.5848260542
},
{
"command": "pacquet@main",
"mean": 0.6712570445,
"stddev": 0.10189286609740703,
"median": 0.6321659182,
"user": 0.9735379200000001,
"system": 1.0051592999999999,
"min": 0.5841948072,
"max": 0.9234503902000001
},
{
"command": "pnpr@HEAD",
"mean": 0.36022259710000004,
"stddev": 0.029961519978966542,
"median": 0.35914021470000007,
"user": 0.3375406199999999,
"system": 0.6781567999999999,
"min": 0.3178361022,
"max": 0.4002984412000001
},
{
"command": "pnpr@main",
"mean": 0.3628719658000001,
"stddev": 0.022202270757100913,
"median": 0.37138278720000006,
"user": 0.33196751999999996,
"system": 0.6687857999999999,
"min": 0.32256040320000007,
"max": 0.38400918320000005
}
]
}Scenario: Isolated linker: fresh install, cold cache + hot store
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 1.79872108132,
"stddev": 0.13083350571700192,
"median": 1.75523977642,
"user": 1.2818737199999999,
"system": 1.07016522,
"min": 1.65551961742,
"max": 2.01849538542
},
{
"command": "pacquet@main",
"mean": 1.78805530672,
"stddev": 0.09760176020589069,
"median": 1.74065719292,
"user": 1.2183852199999996,
"system": 1.0300871199999997,
"min": 1.7118541934200002,
"max": 1.97116912642
},
{
"command": "pnpr@HEAD",
"mean": 0.31664766202,
"stddev": 0.01944484179695854,
"median": 0.31364479942,
"user": 0.2832356199999999,
"system": 0.57534312,
"min": 0.28448700142,
"max": 0.35146453442
},
{
"command": "pnpr@main",
"mean": 0.31839138682,
"stddev": 0.01917511690816896,
"median": 0.31564255342,
"user": 0.29792781999999995,
"system": 0.57383752,
"min": 0.30050130842,
"max": 0.36452557642
}
]
}Scenario: Isolated linker: fresh resolve, hot cache, offline
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 0.31367535112000006,
"stddev": 0.016135037376779616,
"median": 0.31519787292,
"user": 0.32535455999999996,
"system": 0.12245809999999997,
"min": 0.28622134742000005,
"max": 0.33960613542
},
{
"command": "pacquet@main",
"mean": 0.28620658462000004,
"stddev": 0.01319508089927943,
"median": 0.28140435192,
"user": 0.28153695999999995,
"system": 0.11159159999999999,
"min": 0.27060622442000004,
"max": 0.30397890642000003
},
{
"command": "pnpr@HEAD",
"mean": 0.09733303349407407,
"stddev": 0.0077349982621154655,
"median": 0.09349433042,
"user": 0.035716152592592594,
"system": 0.015599688888888893,
"min": 0.08661838642,
"max": 0.11137552642000001
},
{
"command": "pnpr@main",
"mean": 0.09076644876482759,
"stddev": 0.003326542074650056,
"median": 0.09041494242,
"user": 0.030460318620689656,
"system": 0.01386818620689655,
"min": 0.08577657442,
"max": 0.09746958442
}
]
}Scenario: Isolated linker: peer-heavy resolve, hot cache, offline
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 0.3366837170444444,
"stddev": 0.018649831710152494,
"median": 0.3332436276,
"user": 0.3471709266666666,
"system": 0.07510065333333331,
"min": 0.3131374426,
"max": 0.3709296646
},
{
"command": "pacquet@main",
"mean": 0.31339080671111114,
"stddev": 0.019737380866674033,
"median": 0.3241815116,
"user": 0.32872370444444443,
"system": 0.06694065333333334,
"min": 0.2708292216,
"max": 0.3291525306
},
{
"command": "pnpm@HEAD",
"mean": 4.341185886933334,
"stddev": 0.6278482417251363,
"median": 4.089254411600001,
"user": 6.542942704444443,
"system": 0.49415254222222216,
"min": 3.5998670426,
"max": 5.4690094236
}
]
}Scenario: Isolated linker: linked-workspace resolve, hot cache, offline
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 0.2583209355,
"stddev": 0.01752289538522191,
"median": 0.2543873095,
"user": 0.21566776000000001,
"system": 0.10502039999999999,
"min": 0.2374329615,
"max": 0.2993740355
},
{
"command": "pacquet@main",
"mean": 0.2495329965909091,
"stddev": 0.015041581682800934,
"median": 0.2479249315,
"user": 0.19516648727272726,
"system": 0.10888169090909092,
"min": 0.2336140985,
"max": 0.2860298235
}
]
}Scenario: Isolated linker: injected workspace repeat install, hot cache + hot store
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 0.08445808220787877,
"stddev": 0.006076723895805222,
"median": 0.08297549342,
"user": 0.030095109090909098,
"system": 0.06063249151515151,
"min": 0.07656638842,
"max": 0.10142746942
},
{
"command": "pacquet@main",
"mean": 0.09164200030888887,
"stddev": 0.01600439387644127,
"median": 0.08488223042,
"user": 0.03396150555555555,
"system": 0.06488597888888888,
"min": 0.07880052842,
"max": 0.14109316442
}
]
}Scenario: Isolated linker: fresh restore, cold cache + cold store + cold pnpr
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 5.2226248145400005,
"stddev": 0.23031878349450716,
"median": 5.140842468640001,
"user": 2.7261601000000004,
"system": 2.5113453800000003,
"min": 5.00390516314,
"max": 5.66689189614
},
{
"command": "pacquet@main",
"mean": 5.01757781734,
"stddev": 0.17069660357387023,
"median": 4.945375691140001,
"user": 2.5885536999999994,
"system": 2.3223812799999997,
"min": 4.86044061714,
"max": 5.39480629114
},
{
"command": "pnpr@HEAD",
"mean": 3.94676706244,
"stddev": 0.14486576288668748,
"median": 3.9340954206400003,
"user": 2.2686922,
"system": 2.1251492800000005,
"min": 3.66526907614,
"max": 4.14910415914
},
{
"command": "pnpr@main",
"mean": 3.86716655094,
"stddev": 0.18785968910732184,
"median": 3.8489847466400002,
"user": 2.0064468,
"system": 1.8984318800000004,
"min": 3.5388121851400003,
"max": 4.13547390714
}
]
}Scenario: GVS linker: fresh restore, hot cache + hot storeSame install as the isolated fresh-restore hot/hot scenario, into the shared virtual store, the layout pnpm 12 installs into by default. Scenarios run on separate machines, so compare main and branch within each table.
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 0.19086929143428574,
"stddev": 0.0218600925715581,
"median": 0.18509687622,
"user": 0.2424111114285714,
"system": 0.1919376142857143,
"min": 0.16700211422,
"max": 0.24219483422000002
},
{
"command": "pacquet@main",
"mean": 0.20436386898923078,
"stddev": 0.014446809179912664,
"median": 0.20338296722000002,
"user": 0.2720792707692307,
"system": 0.19072305384615382,
"min": 0.18413250122000002,
"max": 0.23194403922
},
{
"command": "pnpr@HEAD",
"mean": 0.22964765580333338,
"stddev": 0.017820434742617266,
"median": 0.23106976072000002,
"user": 0.2758388733333333,
"system": 0.20761323333333334,
"min": 0.19921383922000002,
"max": 0.25116880222000004
},
{
"command": "pnpr@main",
"mean": 0.24228808672000005,
"stddev": 0.02626803338227521,
"median": 0.23600447372,
"user": 0.29269529,
"system": 0.2198029,
"min": 0.20728731422000002,
"max": 0.29345631022
}
]
}Scenario: Store only: unlocked direct deps, cold cache + hot storeStore-only install (
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 1.29961090368,
"stddev": 0.10762309124097573,
"median": 1.29368745408,
"user": 0.78930072,
"system": 0.31417367999999996,
"min": 1.16794286558,
"max": 1.45596296958
},
{
"command": "pacquet@main",
"mean": 1.2077951083799998,
"stddev": 0.02500043306522384,
"median": 1.19942207058,
"user": 0.65204942,
"system": 0.25715088,
"min": 1.17931333258,
"max": 1.25583801858
}
]
} |
This is surprisingly slow; it doesn't take this long in pnpm 11 and below. Very odd |
hmm.. let me get back to you on that. |
Thanks for flagging this, Jake. The 24-minute figure came from my initial validation run, not a controlled benchmark; competing CPU load may have affected it. I should have made that limitation clear. In subsequent controlled comparisons that completed, the patch was slightly faster than the unpatched main. I’m still investigating the full-workspace memory issue and the performance gap versus pnpm 11. |
Count dependency-waiting dedicated installs toward workspaceConcurrency so large workspaces do not retain every project installation at once. Preserve dependency ordering, overlap within the limit, and error handling. Fixes pnpm#16966.
2d4bc49 to
3bc531e
Compare
Share discovered workspace projects and the resolver package map within plain dedicated installs when scripts, hooks, project settings and other ecosystem builds cannot change the inputs. Keep discovery fresh for mutating paths and preserve the existing unfinished-install bound. Avoid repeated full-workspace parsing and allocation that could still exhaust memory after scheduling was bounded. Cover filtered siblings, fresh subsequent commands, lifecycle and pnpmfile mutations, and injected dependencies through the CLI.
Replace the opt-in discovery cache with the projects the install command already discovered before any project ran. Each per-project install of a `sharedWorkspaceLockfile: false` workspace reads that list and the workspace-package index built from it once, so a workspace of N projects no longer reparses and copies N^2 manifests, whether or not scripts or pnpmfiles are enabled. The list is the one pnpm v11 hands to every project's install as well. Drop the semaphore the bounded admission made redundant: at most `concurrency` installs are admitted, and each held at most one of its `concurrency` permits, so acquiring one never waited. The two CLI tests that expected a later project to see a manifest a lifecycle script or pnpmfile rewrote are removed. Neither v11 nor the released v12 links to the rewritten target, and with concurrent installs the result depended on which install started first. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…imits Group the loaded projects with the command's discovered workspace, and the fresh resolve's index source into one field, so neither struct grows past eight fields and `discover` stays short. The loading moves into its own module. Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
On the slowness Jake raised: the per-project installs of a
@jatmn, this replaces the opt-in cache from Written by an agent (Claude Code, claude-opus-5-5). |
|
@coderabbitai review |
There was a problem hiding this comment.
Your trial has ended. Reactivate Greptile to resume code reviews.
PR Summary by QodoBound dedicated workspace installs and reuse workspace discovery
AI Description
Diagram
High-Level Assessment
Files changed (18)
|
|
Nice! Can't wait to update. |
Code Review by Qodo
1.
|
PR Code Suggestions ✨Warning
No code suggestions found for the PR. |
|
A project that cannot start before its workspace dependencies finish held one of the bounded slots while it waited, so with `injectWorkspacePackages` or many `preinstall` scripts a slow dependency could idle every slot while independent projects were ready. A project now takes a slot only when it starts, and starts once each workspace project it depends on has started. Every install in flight then depends only on installs in flight or done, so the bound cannot deadlock. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…zily With `excludeLinksFromLockfile` and `linkWorkspacePackages`, each dedicated install still built the workspace-package index of every project for its link checks. It now takes the command's index too. The index is built the first time an install asks for it, so `add`, `update` and `remove`, whose installs walk the workspace themselves, no longer build one they never read. Co-Authored-By: Claude Opus 5.5 <[email protected]>
There was a problem hiding this comment.
Your trial has ended. Reactivate Greptile to resume code reviews.
|
Code review by qodo was updated up to the latest commit d5dde72 |
PR Code Suggestions ✨Warning
No code suggestions found for the PR. |
|
Qodo findings on
Written by an agent (Claude Code, claude-opus-5-5). |
The updates address findings 1–3 as described:
|
Summary
Installing a large workspace with
sharedWorkspaceLockfile: falsecould retain an unfinished install for every project. Each project's install also walked the whole workspace again, parsed every project manifest, and copied every manifest into its own workspace-package index. A workspace of N projects therefore did N² manifest reads and copies.workspaceConcurrencyslots from its start until it returns, including while it waits for its workspace dependencies before linking. A project starts once every workspace project it depends on has started, so every install in flight depends only on installs that are in flight or done, and the bound cannot deadlock. A project that must wait for its dependencies to finish before it starts (apreinstallscript, or an injected orfile:dependency) holds no slot while it waits. The dependency gates still let resolution overlap dependency scripts, and keep script ordering and failure propagation.allProjectslist and oneworkspacePackagesmap to every project's install (createRecursiveContext). Commands that edit manifests (add,update,remove) keep walking per project.Fixes #16966.
Benchmarks
All 9,028 project manifests of the pinned DefinitelyTyped reproduction, manifest-only checkout, default concurrency, warm store and metadata cache,
--prefer-offline, Linux x64 with 32 cores. pnpm 11 and this PR ran alternately, three runs each:d5dde728c)3bc531ebf), one runAt 2,000 projects: pnpm 11 20 s / 1.8 GB, admission bound only 46 s / 2.9 GB, this PR 3.9 s / 0.54 GB.
Profiling the admission-bound build showed the time going to
load_workspace_projectsinside every project's install and to building and dropping the per-install workspace-package index. WithMALLOC_ARENA_MAX=4the same build peaked at about 0.4 GB, so most of its RSS was heap fragmentation from that churn rather than live data. Sharing the list and the index removed both.Online runs against registry.npmjs.org showed intermittent stalls of 8-18 s in both pnpm 11 and pnpm 12, on whichever ran at the time, so the table uses
--prefer-offline.Behavior
Two CLI regressions from
db35218e6are not kept. They expected a later project's install to link to a target that an earlier project's lifecycle script or pnpmfile wrote into its manifest during the same install. pnpm 11.28.6 and pnpm 12.14.0 both link to the manifest as it was when the command started (checked with the same fixture), and with concurrent installs the outcome depended on which install started first. This PR keeps that start-of-command snapshot.Validation
Reviewed commit:
d5dde728c1d57c77f97b031ca7bb27a1ebc32353.pnpm-cliandpnpm-package-managersuites: 6,443 passed, 5 skipped.buffer_unorderedscheduler.node_modulessymlink trees of a 500-project subset are identical between this PR and a build that still walks the workspace per project. The.modules.yamlfiles differ only inprunedAt.db35218e6: filtered sibling resolution with fresh discovery on the next command, and injected workspace dependencies.Squash Commit Body
Checklist
pacquet.Written by an agent (Codex, GPT-6). Updated by an agent (Claude Code, claude-opus-5-5).