Repository navigation
perf(install): probe direct dependency links in parallel on repeat install - #16488
Conversation
Qodo reviews are paused for this user.Troubleshooting steps vary by plan Learn more → On a Teams plan? Using GitHub Enterprise Server, GitLab Self-Managed, or Bitbucket Data Center? |
|
Navigate logical layers of code changes, visualize relationships, and explore their blast radius. No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository: pnpm/pnpm/.coderabbit.yaml Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 2 remain after this review. 📝 WalkthroughWalkthroughThe repeat-install dangling-link check now searches project manifests in parallel. Its predicate and result condition remain unchanged. A changeset records the update. ChangesRepeat install link checks
Priority: ➖ Normal Estimated code review effort: 2 (Simple) | ~8 minutes Change: Bug fix · Severity of issue fixed: Medium Assessment against linked issues
Suggested labels: Merge Risk: ⚪ Minimal · up to The parallel check preserves dangling-link detection and the fallback to a full install. No actionable merge-blocking risk was identified; the change is ready to merge subject to normal checks. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Copilot review overview
🟢 Approval recommended
It is a verified two-line, thread-safe iter-to-par_iter change that preserves behavior, matches an established parallel pattern in the same module, and ships a conventional changeset.
Review effort: Balanced
Findings: None
What changed in this PR
This PR is a focused performance optimization for the repeat-install fast path in the Rust pnpm v12 CLI (pacquet). The direct_dependency_link_dangling gate, which probes each project's direct dependency links with a link-following stat, previously ran sequentially on the main thread as the final gate before a no-op install reports "Already up to date." In large workspaces this doubled no-op install time (a regression introduced in 12.7.0). The change moves the per-project probe onto the rayon pool that the fast path already builds for project discovery, while preserving the per-entry probing, short-circuit-on-first-dangling-link behavior, and existing tests.
Changes:
- Switched the outer project iteration in
direct_dependency_link_danglingfrom.iter()to.par_iter()and added therayon::preludeimport. - Added a changeset documenting the faster repeat-install behavior for release notes.
| File | Description |
|---|---|
pnpm/crates/package-manager/src/optimistic_repeat_install/modules_dirs.rs |
Parallelizes the per-project dangling-link probe with rayon's par_iter, keeping the same read-only stat work and short-circuit semantics. |
.changeset/parallel-dangling-link-probe.md |
Adds a pacquet patch changeset describing the faster "Already up to date" repeat install. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #16488 +/- ##
=======================================
Coverage 92.19% 92.20%
=======================================
Files 1526 1526
Lines 205522 205522
=======================================
+ Hits 189487 189498 +11
+ Misses 16035 16024 -11 ☔ 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-workspace scenario compares 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.6474915880400003,
"stddev": 0.10559180203236936,
"median": 2.6218128385400004,
"user": 2.52721284,
"system": 2.2861057000000002,
"min": 2.47331773354,
"max": 2.82094886754
},
{
"command": "pacquet@main",
"mean": 2.6757761958399997,
"stddev": 0.10893690735458167,
"median": 2.6552847115400002,
"user": 2.5086268399999994,
"system": 2.3538314,
"min": 2.5295537815399998,
"max": 2.84852108854
},
{
"command": "pnpr@HEAD",
"mean": 1.6401380461400001,
"stddev": 0.09943621352991472,
"median": 1.65037366404,
"user": 2.3353383399999994,
"system": 2.0815111,
"min": 1.52547095554,
"max": 1.82234282454
},
{
"command": "pnpr@main",
"mean": 1.5853345311399998,
"stddev": 0.13643475023776222,
"median": 1.54361182004,
"user": 2.26778064,
"system": 2.0874823,
"min": 1.42197905254,
"max": 1.78574858054
}
]
}Scenario: Isolated linker: fresh restore, hot cache + hot store
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 0.97536508838,
"stddev": 0.4507652702816301,
"median": 1.13774440088,
"user": 0.6126974599999999,
"system": 1.26518008,
"min": 0.32410794238,
"max": 1.43812742238
},
{
"command": "pacquet@main",
"mean": 0.4140750713800001,
"stddev": 0.04505132509590438,
"median": 0.41422722288,
"user": 0.47829726,
"system": 0.88603408,
"min": 0.34017084738000003,
"max": 0.48703588838000006
},
{
"command": "pnpr@HEAD",
"mean": 0.37031383538,
"stddev": 0.05942505733161081,
"median": 0.35391693038000005,
"user": 0.42252896,
"system": 0.7967411799999999,
"min": 0.31771064538000005,
"max": 0.52120202738
},
{
"command": "pnpr@main",
"mean": 0.30197679768,
"stddev": 0.018641370331013384,
"median": 0.30210770388,
"user": 0.32130776,
"system": 0.6820362799999999,
"min": 0.27785598438000003,
"max": 0.34090967138
}
]
}Scenario: Isolated linker: repeat install, hot cache + hot store
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 0.020016563028130083,
"stddev": 0.002358507807093963,
"median": 0.01994240202,
"user": 0.011034749268292676,
"system": 0.010758248292682928,
"min": 0.01514403902,
"max": 0.026798926020000002
},
{
"command": "pacquet@main",
"mean": 0.014557066110163934,
"stddev": 0.0038801300384773193,
"median": 0.013079601520000001,
"user": 0.008361010163934422,
"system": 0.007598054590163935,
"min": 0.010005657020000001,
"max": 0.02445561802
},
{
"command": "pnpr@HEAD",
"mean": 0.011798161508151665,
"stddev": 0.0014937484529001827,
"median": 0.01155437902,
"user": 0.00670970710900474,
"system": 0.006215899810426537,
"min": 0.00865656802,
"max": 0.01676075902
},
{
"command": "pnpr@main",
"mean": 0.013679020578139533,
"stddev": 0.0022923950163447992,
"median": 0.01338175502,
"user": 0.007957901767441863,
"system": 0.0070223069767441845,
"min": 0.008654776020000001,
"max": 0.02088667702
}
]
}Scenario: Isolated linker: repeat install, cold cache + hot store
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 0.0505881070943182,
"stddev": 0.022262601014120222,
"median": 0.0528613536,
"user": 0.013766183181818182,
"system": 0.027782864318181832,
"min": 0.0122340126,
"max": 0.1461305836
},
{
"command": "pacquet@main",
"mean": 0.04965383732972974,
"stddev": 0.016293918110616187,
"median": 0.0468880916,
"user": 0.01426540216216216,
"system": 0.026714782162162165,
"min": 0.0281312266,
"max": 0.1160235966
},
{
"command": "pnpr@HEAD",
"mean": 0.04364691089333333,
"stddev": 0.013480495173923223,
"median": 0.039588755600000004,
"user": 0.016272533333333332,
"system": 0.02200922,
"min": 0.023037529600000002,
"max": 0.07765392460000001
},
{
"command": "pnpr@main",
"mean": 0.02642055278367348,
"stddev": 0.00600963114865674,
"median": 0.0256581281,
"user": 0.012664331836734696,
"system": 0.015176487346938779,
"min": 0.0154681476,
"max": 0.0525836586
}
]
}Scenario: Isolated linker: fresh install, cold cache + cold store
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 3.12950611316,
"stddev": 0.19728785372269805,
"median": 3.0941433200599997,
"user": 3.4686673,
"system": 2.7325206399999997,
"min": 2.86216988656,
"max": 3.50796259756
},
{
"command": "pacquet@main",
"mean": 2.8933773319599996,
"stddev": 0.13451074338058222,
"median": 2.8941701270599998,
"user": 2.9961244000000002,
"system": 2.32243214,
"min": 2.75350845356,
"max": 3.1685198295599997
},
{
"command": "pnpr@HEAD",
"mean": 1.6204349321600002,
"stddev": 0.1505148128819257,
"median": 1.5403015985600002,
"user": 1.5293799999999997,
"system": 1.60454564,
"min": 1.4786947695600001,
"max": 1.8517209465600002
},
{
"command": "pnpr@main",
"mean": 1.6574955146600003,
"stddev": 0.12893821391419896,
"median": 1.66054820006,
"user": 1.6402082999999998,
"system": 1.71450884,
"min": 1.4717154975600002,
"max": 1.9112554405600002
}
]
}Scenario: Isolated linker: fresh install, hot cache + hot store
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 0.53653849426,
"stddev": 0.03760562144272277,
"median": 0.5465877824600001,
"user": 0.7696696999999999,
"system": 0.8513881199999999,
"min": 0.46559487446000003,
"max": 0.5836317924600001
},
{
"command": "pacquet@main",
"mean": 0.57833229726,
"stddev": 0.0308934113922357,
"median": 0.5847437339600001,
"user": 0.8405974,
"system": 0.91936342,
"min": 0.51470249846,
"max": 0.61489567546
},
{
"command": "pnpr@HEAD",
"mean": 0.35078503256000004,
"stddev": 0.0344328590016884,
"median": 0.33222358296,
"user": 0.3196226,
"system": 0.6727603199999999,
"min": 0.31564923346,
"max": 0.41475755646
},
{
"command": "pnpr@main",
"mean": 0.32830112016,
"stddev": 0.00518575139031421,
"median": 0.32886230246000003,
"user": 0.3159514,
"system": 0.61493952,
"min": 0.32008849946,
"max": 0.33491467046
}
]
}Scenario: Isolated linker: fresh install, cold cache + hot store
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 1.8393411273599998,
"stddev": 0.06235516538905146,
"median": 1.8461126653600002,
"user": 1.2522683,
"system": 1.10391446,
"min": 1.71692465836,
"max": 1.91475213136
},
{
"command": "pacquet@main",
"mean": 1.7193648115600002,
"stddev": 0.03804160101970781,
"median": 1.70865939486,
"user": 1.0774191,
"system": 0.8959338599999999,
"min": 1.68251501936,
"max": 1.7896581443600001
},
{
"command": "pnpr@HEAD",
"mean": 0.35903976006,
"stddev": 0.018843484685826972,
"median": 0.36637645385999995,
"user": 0.33843869999999987,
"system": 0.6941367600000001,
"min": 0.32696670736,
"max": 0.37961164636
},
{
"command": "pnpr@main",
"mean": 0.39745036506,
"stddev": 0.02369400715327978,
"median": 0.40381779136,
"user": 0.38865479999999997,
"system": 0.76103666,
"min": 0.35879249836,
"max": 0.42735637836
}
]
}Scenario: Isolated linker: fresh resolve, hot cache, offline
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 0.2508454706166667,
"stddev": 0.02662334377504348,
"median": 0.24204428620000001,
"user": 0.21791099,
"system": 0.09874211,
"min": 0.20810915070000002,
"max": 0.3081308447
},
{
"command": "pacquet@main",
"mean": 0.23498835251818181,
"stddev": 0.017296786615361902,
"median": 0.23545051170000003,
"user": 0.2136761490909091,
"system": 0.08259263272727271,
"min": 0.19771048870000002,
"max": 0.2618608157
},
{
"command": "pnpr@HEAD",
"mean": 0.09648193156206895,
"stddev": 0.0027434663165887907,
"median": 0.09658061470000001,
"user": 0.039986515862068965,
"system": 0.014110670344827585,
"min": 0.09158487570000001,
"max": 0.10203273970000001
},
{
"command": "pnpr@main",
"mean": 0.10564930729259263,
"stddev": 0.005793386623182244,
"median": 0.10596407070000001,
"user": 0.04408379555555556,
"system": 0.019915545185185186,
"min": 0.0953569377,
"max": 0.11833982670000001
}
]
}Scenario: Isolated linker: peer-heavy resolve, hot cache, offline
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 0.32696277070222224,
"stddev": 0.02201721303443757,
"median": 0.32504856748000005,
"user": 0.35324930888888884,
"system": 0.06744111777777778,
"min": 0.29829969448000004,
"max": 0.36458549048000005
},
{
"command": "pacquet@main",
"mean": 0.29514728848000005,
"stddev": 0.0044350705629379,
"median": 0.29484383748000004,
"user": 0.31972675333333334,
"system": 0.061314339999999995,
"min": 0.28688197048,
"max": 0.30049552248000005
},
{
"command": "pnpm@HEAD",
"mean": 4.2121233009244445,
"stddev": 0.25171144264861567,
"median": 4.18152468848,
"user": 6.570522975555555,
"system": 0.4617575622222222,
"min": 3.8201029864800002,
"max": 4.73110148948
}
]
}Scenario: Isolated linker: linked-workspace resolve, hot cache, offline
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 0.30419281912,
"stddev": 0.027632120411252178,
"median": 0.29661076792,
"user": 0.24654094,
"system": 0.11799564,
"min": 0.27156699042000004,
"max": 0.36379890542000004
},
{
"command": "pacquet@main",
"mean": 0.30609353612,
"stddev": 0.05416647218342368,
"median": 0.28655481342,
"user": 0.23576654000000002,
"system": 0.12892763999999998,
"min": 0.26161293742,
"max": 0.43907953642
}
]
}Scenario: Isolated linker: fresh restore, cold cache + cold store + cold pnpr
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 4.68392362252,
"stddev": 0.21173510353325148,
"median": 4.57649972752,
"user": 1.9800558,
"system": 2.1294154799999996,
"min": 4.47508936102,
"max": 5.07437066302
},
{
"command": "pacquet@main",
"mean": 4.565509599019999,
"stddev": 0.1329266927488599,
"median": 4.4961169860200005,
"user": 1.8815245999999999,
"system": 1.9855749800000002,
"min": 4.46002075102,
"max": 4.81271506702
},
{
"command": "pnpr@HEAD",
"mean": 3.6347354707200004,
"stddev": 0.12399212568272433,
"median": 3.58209143302,
"user": 1.7231662999999997,
"system": 1.8358150800000002,
"min": 3.50580507602,
"max": 3.80244152102
},
{
"command": "pnpr@main",
"mean": 3.6304614952199996,
"stddev": 0.07460742904757596,
"median": 3.60701721902,
"user": 1.8052190999999997,
"system": 1.8704565799999997,
"min": 3.52961297202,
"max": 3.76488744802
}
]
}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.1810675198657143,
"stddev": 0.014106964489901931,
"median": 0.17505172958,
"user": 0.23000174857142858,
"system": 0.17429332,
"min": 0.16232914558,
"max": 0.20019996058
},
{
"command": "pacquet@main",
"mean": 0.17907012373384615,
"stddev": 0.009151354551798946,
"median": 0.17942538758,
"user": 0.22692085846153842,
"system": 0.1772580892307692,
"min": 0.15929087458000002,
"max": 0.19220498858
},
{
"command": "pnpr@HEAD",
"mean": 0.19359050250307697,
"stddev": 0.010173153467268317,
"median": 0.19286908458000002,
"user": 0.2320607046153846,
"system": 0.1767570123076923,
"min": 0.17572524358000002,
"max": 0.21508527258000001
},
{
"command": "pnpr@main",
"mean": 0.20511306811846156,
"stddev": 0.0165327196308712,
"median": 0.20073960658,
"user": 0.23829301230769231,
"system": 0.18736747384615388,
"min": 0.19072362358000003,
"max": 0.25192401057999997
}
]
} |
…stall The dangling direct-dependency gate added in #15569 makes one link-following stat per direct dependency of every workspace project, sequentially on the main thread, before a repeat install can report "Already up to date". In a 500-project workspace with 20 dependencies each, that doubled the no-op install time from 12.6.0. The projects are now probed on the rayon pool, which the fast path has already built for project discovery. The probe still covers every entry and stops at the first dangling link. Skipping the probe on per-directory mtimes was rejected: a deleted virtual-store package, a pruned global virtual store entry, or a removed link: target moves no mtime the fast path can read. Closes #16487
97a8a79 to
66af19d
Compare
Code Review by Qodo
1.
|
PR Code Suggestions ✨Warning
No code suggestions found for the PR. |
There was a problem hiding this comment.
Copilot review overview
🟢 Approval recommended
The change is a minimal, behavior-preserving .iter() to .par_iter() swap that follows an established in-crate convention, keeps the short-circuit gate correct, uses only thread-safe read-only probes, and ships a compliant changeset.
Review effort: Balanced
Findings: None
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #16488 +/- ##
=======================================
Coverage 92.19% 92.20%
=======================================
Files 1527 1527
Lines 205671 205671
=======================================
+ Hits 189623 189631 +8
+ Misses 16048 16040 -8 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
Code review by qodo was updated up to the latest commit babeb6c |
PR Code Suggestions ✨Warning
No code suggestions found for the PR. |
There was a problem hiding this comment.
Copilot review overview
🟢 Approval recommended
It is a small, idiomatic rayon parallelization consistent with existing crate patterns, preserves behavior and short-circuit semantics, is type-system-guaranteed thread-safe, and includes a conventional changeset.
Review effort: Balanced
Findings: None
|
Review-and-fix pass:
Status on babeb6c: all checks pass. CodeRabbit (approved), Copilot and Qodo have reviewed this head and found nothing left to act on. Nothing remains in scope. Written by an agent (Claude Code, claude-opus-5-5). |
Summary
A no-op
pnpm installin a 500-project workspace drops from 37.6 ms to 24.5 ms on macOS (1.53x). It was 18.8 ms in 12.6.0, so this recovers about two thirds of the regression from 12.7.0.Closes #16487
direct_dependency_link_danglingas the last gate of the fast path. It makes one link-followingstatper direct dependency of every project, one after another on the main thread.git merge-tree).findDanglingDirectDependencyLinkalready runs itsstatcalls concurrently throughPromise.all.Why not skip the probe: no per-directory evidence proves a target still exists. An mtime gate on the project's
node_modulescatches a retargeted link but misses a deleted.pnpm/<pkg>/node_modules/<name>, a pruned global virtual store entry, and a removedlink:target, which #15569 catches today.Measurements
macOS arm64, 18 cores. Workspace of 500 projects, each with 20
workspace:*dependencies (10000 entries); script in #16487. Before is this branch with the patch reverted, after is this branch, bothcargo build --releasewith LTO off.hyperfine -N -w 5 -r 40 '<bin> install --offline --reporter=silent':/usr/bin/time -l)A second run gave 40.7 ms before and 27.2 ms after (1.49x).
The trade-off is CPU: the
statcount is unchanged and the kernel spends more system time on contended path lookups. On this machine a standalone C loop over the same 10000 links stops scaling at about 4 threads (19.7 ms on 1, 8.6 ms on 4, 10.8 ms on 16).Not measured: Linux and Windows wall time. Windows
statcosts more per call, so the parallel probe should matter more there, but I have no numbers.Squash Commit Body
Checklist
already linked to it solves it.
are implemented in every affected version.
pnpm changeset) if this PR changes any publishedpackage. Keep it short and written for pnpm users — it becomes a release note.
No new test: the change keeps behavior and only moves work onto the pool, so no behavioral test fails with it reverted. The reverted-patch proof is the "before" row above. Ran
pnpm test:rust -p pnpm-package-manager -E 'test(optimistic_repeat_install)'(147 passed) andpnpm test:rust -p pnpm-cli -E 'test(repeat_install::)'(33 passed), which include the #15569 dangling-link tests.Written by an agent (Claude Code, Opus 5.5).
Need help on this PR? Tag
@codesmith-botwith what you need. Autofix is disabled.Summary by CodeRabbit