Skip to content

perf(install): probe direct dependency links in parallel on repeat install - #16488

Merged
zkochan merged 2 commits into
pnpm:mainfrom
altaywtf:perf/noop-install-dangling-link-probe
Oct 1, 2026
Merged

zkochan merged 2 commits into
pnpm:mainfrom
altaywtf:perf/noop-install-dangling-link-probe

Conversation

@altaywtf

@altaywtf altaywtf commented Oct 1, 2026 •

Copy link
Copy Markdown
Member

Summary

A no-op pnpm install in 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

Why not skip the probe: no per-directory evidence proves a target still exists. An mtime gate on the project's node_modules catches a retargeted link but misses a deleted .pnpm/<pkg>/node_modules/<name>, a pruned global virtual store entry, and a removed link: 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, both cargo build --release with LTO off. hyperfine -N -w 5 -r 40 '<bin> install --offline --reporter=silent':

wall user system instructions retired (/usr/bin/time -l)
12.6.0 (published) 18.8 ms ± 1.4 13.3 ms 48.6 ms 337-339M
before 37.6 ms ± 0.9 20.3 ms 56.6 ms 641-646M
after 24.5 ms ± 1.3 23.6 ms 99.8 ms 649-661M

A second run gave 40.7 ms before and 27.2 ms after (1.49x).

The trade-off is CPU: the stat count 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 stat costs more per call, so the parallel probe should matter more there, but I have no numbers.

Squash Commit Body

The dangling direct-dependency gate added in pnpm/pnpm#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 pnpm/pnpm#16487

Checklist

  • I checked the referenced issue and verified that none of the PRs
    already linked to it solves it.
  • New features are implemented only in the Rust pnpm v12 CLI. Bug fixes
    are implemented in every affected version.
  • Added a changeset (pnpm changeset) if this PR changes any published
    package. Keep it short and written for pnpm users — it becomes a release note.
  • Added or updated tests.

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) and pnpm 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).


View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need. Autofix is disabled.

Summary by CodeRabbit

  • Performance
    • Repeat installs in large workspaces report “Already up to date” faster by checking workspace dependency links in parallel.

Copilot AI balanced review requested due to automatic review settings October 1, 2026 15:38
@altaywtf
altaywtf requested a review from zkochan as a code owner October 1, 2026 15:38
@qodo-code-review

Copy link
Copy Markdown

Qodo reviews are paused for this user.

Troubleshooting steps vary by plan Learn more →

On a Teams plan?
Reviews resume once this user has a paid seat and their Git account is linked in Qodo.
Link Git account →

Using GitHub Enterprise Server, GitLab Self-Managed, or Bitbucket Data Center?
These require an Enterprise plan - Contact us
Contact us →

@coderabbitai

coderabbitai Bot commented Oct 1, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

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 configuration

Configuration used: Repository: pnpm/pnpm/.coderabbit.yaml

Review profile: CHILL

Plan: Advanced

Run ID: 173f1b88-48da-4a28-8f15-23b990e9b55c

📥 Commits

Reviewing files that changed from the base of the PR and between 66af19d and babeb6c.

📒 Files selected for processing (1)
  • .changeset/parallel-dangling-link-probe.md
🚧 Files skipped from review as they are similar to previous changes (1)
  • .changeset/parallel-dangling-link-probe.md

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 2 remain after this review.


📝 Walkthrough

Walkthrough

The repeat-install dangling-link check now searches project manifests in parallel. Its predicate and result condition remain unchanged. A changeset records the update.

Changes

Repeat install link checks

Layer / File(s) Summary
Parallelize the dangling-link probe
pnpm/crates/package-manager/src/optimistic_repeat_install/modules_dirs.rs, .changeset/parallel-dangling-link-probe.md
The check now uses Rayon parallel iteration across project manifests. It still returns true when any project has a dangling direct-dependency link. The changeset describes the update.

Priority: ➖ Normal

Estimated code review effort: 2 (Simple) | ~8 minutes

Change: Bug fix · Severity of issue fixed: Medium

Assessment against linked issues

Objective Addressed Explanation
Keep repeat installs in large workspaces close to the prior no-op install performance [#16487] ❓ The check now runs in parallel, but the diff provides no timing results to verify performance against 12.6.0.
Continue relinking direct dependencies whose links point to missing targets [#16487] ✅

Suggested labels: product: pacquet

Merge Risk: ⚪ Minimal · up to babeb

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)
  • Create a new PR
  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Autopilot is currently an internal CodeRabbit preview.


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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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_dangling from .iter() to .par_iter() and added the rayon::prelude import.
  • 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.

@github-actions github-actions Bot added the reviewed: coderabbit CodeRabbit submitted an approving review label Oct 1, 2026
@codecov-commenter

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 92.20%. Comparing base (50f09c2) to head (97a8a79).

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.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@github-actions

github-actions Bot commented Oct 1, 2026 •

Copy link
Copy Markdown
Contributor

Same-run regression check

HEAD 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.

Scenario Engine main median HEAD median Change Tolerance Result
isolated-fresh-restore-cold-cache-cold-store pacquet 2655.28 ms 2621.81 ms -1.3% 132.76 ms Within tolerance
isolated-fresh-restore-cold-cache-cold-store pnpr 1543.61 ms 1650.37 ms 6.9% 77.18 ms Inconclusive (overlapping samples)
isolated-fresh-restore-hot-cache-hot-store pacquet 414.23 ms 1137.74 ms 174.7% 20.71 ms Inconclusive (overlapping samples)
isolated-fresh-restore-hot-cache-hot-store pnpr 302.11 ms 353.92 ms 17.1% 15.11 ms Inconclusive (overlapping samples)
isolated-repeat-install-hot-cache-hot-store pacquet 13.08 ms 19.94 ms 52.5% 2.00 ms Inconclusive (overlapping samples)
isolated-repeat-install-hot-cache-hot-store pnpr 13.38 ms 11.55 ms -13.7% 2.00 ms Within tolerance
isolated-repeat-install-cold-cache-hot-store pacquet 46.89 ms 52.86 ms 12.7% 2.34 ms Inconclusive (overlapping samples)
isolated-repeat-install-cold-cache-hot-store pnpr 25.66 ms 39.59 ms 54.3% 2.00 ms Inconclusive (overlapping samples)
isolated-fresh-install-cold-cache-cold-store pacquet 2894.17 ms 3094.14 ms 6.9% 144.71 ms Inconclusive (overlapping samples)
isolated-fresh-install-cold-cache-cold-store pnpr 1660.55 ms 1540.30 ms -7.2% 83.03 ms Within tolerance
isolated-fresh-install-hot-cache-hot-store pacquet 584.74 ms 546.59 ms -6.5% 29.24 ms Within tolerance
isolated-fresh-install-hot-cache-hot-store pnpr 328.86 ms 332.22 ms 1.0% 16.44 ms Within tolerance
isolated-fresh-install-cold-cache-hot-store pacquet 1708.66 ms 1846.11 ms 8.0% 85.43 ms Inconclusive (overlapping samples)
isolated-fresh-install-cold-cache-hot-store pnpr 403.82 ms 366.38 ms -9.3% 20.19 ms Within tolerance
isolated-fresh-resolve-hot-cache-offline pacquet 235.45 ms 242.04 ms 2.8% 11.77 ms Within tolerance
isolated-fresh-resolve-hot-cache-offline pnpr 105.96 ms 96.58 ms -8.9% 5.30 ms Within tolerance
isolated-peer-heavy-resolve-hot-cache-offline pacquet 294.84 ms 325.05 ms 10.2% 14.74 ms Inconclusive (overlapping samples)
isolated-linked-workspace-resolve-hot-cache-offline pacquet 286.55 ms 296.61 ms 3.5% 14.33 ms Within tolerance
isolated-fresh-restore-cold-cache-cold-store-cold-pnpr pacquet 4496.12 ms 4576.50 ms 1.8% 224.81 ms Within tolerance
isolated-fresh-restore-cold-cache-cold-store-cold-pnpr pnpr 3607.02 ms 3582.09 ms -0.7% 180.35 ms Within tolerance
gvs-fresh-restore-hot-cache-hot-store pacquet 179.43 ms 175.05 ms -2.4% 8.97 ms Within tolerance
gvs-fresh-restore-hot-cache-hot-store pnpr 200.74 ms 192.87 ms -3.9% 10.04 ms Within tolerance

Integrated-Benchmark Report (Linux)

Commit: babeb6cbd44f

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

Command Mean [s] Min [s] Max [s] Relative
pacquet@HEAD 2.647 ± 0.106 2.473 2.821 1.67 ± 0.16
pacquet@main 2.676 ± 0.109 2.530 2.849 1.69 ± 0.16
pnpr@HEAD 1.640 ± 0.099 1.525 1.822 1.03 ± 0.11
pnpr@main 1.585 ± 0.136 1.422 1.786 1.00
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

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 975.4 ± 450.8 324.1 1438.1 3.23 ± 1.51
pacquet@main 414.1 ± 45.1 340.2 487.0 1.37 ± 0.17
pnpr@HEAD 370.3 ± 59.4 317.7 521.2 1.23 ± 0.21
pnpr@main 302.0 ± 18.6 277.9 340.9 1.00
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

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 20.0 ± 2.4 15.1 26.8 1.70 ± 0.29
pacquet@main 14.6 ± 3.9 10.0 24.5 1.23 ± 0.36
pnpr@HEAD 11.8 ± 1.5 8.7 16.8 1.00
pnpr@main 13.7 ± 2.3 8.7 20.9 1.16 ± 0.24
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

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 50.6 ± 22.3 12.2 146.1 1.91 ± 0.95
pacquet@main 49.7 ± 16.3 28.1 116.0 1.88 ± 0.75
pnpr@HEAD 43.6 ± 13.5 23.0 77.7 1.65 ± 0.63
pnpr@main 26.4 ± 6.0 15.5 52.6 1.00
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

Command Mean [s] Min [s] Max [s] Relative
pacquet@HEAD 3.130 ± 0.197 2.862 3.508 1.93 ± 0.22
pacquet@main 2.893 ± 0.135 2.754 3.169 1.79 ± 0.19
pnpr@HEAD 1.620 ± 0.151 1.479 1.852 1.00
pnpr@main 1.657 ± 0.129 1.472 1.911 1.02 ± 0.12
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

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 536.5 ± 37.6 465.6 583.6 1.63 ± 0.12
pacquet@main 578.3 ± 30.9 514.7 614.9 1.76 ± 0.10
pnpr@HEAD 350.8 ± 34.4 315.6 414.8 1.07 ± 0.11
pnpr@main 328.3 ± 5.2 320.1 334.9 1.00
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

Command Mean [s] Min [s] Max [s] Relative
pacquet@HEAD 1.839 ± 0.062 1.717 1.915 5.12 ± 0.32
pacquet@main 1.719 ± 0.038 1.683 1.790 4.79 ± 0.27
pnpr@HEAD 0.359 ± 0.019 0.327 0.380 1.00
pnpr@main 0.397 ± 0.024 0.359 0.427 1.11 ± 0.09
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

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 250.8 ± 26.6 208.1 308.1 2.60 ± 0.29
pacquet@main 235.0 ± 17.3 197.7 261.9 2.44 ± 0.19
pnpr@HEAD 96.5 ± 2.7 91.6 102.0 1.00
pnpr@main 105.6 ± 5.8 95.4 118.3 1.10 ± 0.07
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

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 327.0 ± 22.0 298.3 364.6 1.11 ± 0.08
pacquet@main 295.1 ± 4.4 286.9 300.5 1.00
pnpm@HEAD 4212.1 ± 251.7 3820.1 4731.1 14.27 ± 0.88
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

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 304.2 ± 27.6 271.6 363.8 1.00
pacquet@main 306.1 ± 54.2 261.6 439.1 1.01 ± 0.20
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

Command Mean [s] Min [s] Max [s] Relative
pacquet@HEAD 4.684 ± 0.212 4.475 5.074 1.29 ± 0.06
pacquet@main 4.566 ± 0.133 4.460 4.813 1.26 ± 0.04
pnpr@HEAD 3.635 ± 0.124 3.506 3.802 1.00 ± 0.04
pnpr@main 3.630 ± 0.075 3.530 3.765 1.00
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 store

Same 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.

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 181.1 ± 14.1 162.3 200.2 1.01 ± 0.09
pacquet@main 179.1 ± 9.2 159.3 192.2 1.00
pnpr@HEAD 193.6 ± 10.2 175.7 215.1 1.08 ± 0.08
pnpr@main 205.1 ± 16.5 190.7 251.9 1.15 ± 0.11
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
Copilot AI balanced review requested due to automatic review settings October 1, 2026 17:15
@zkochan
zkochan force-pushed the perf/noop-install-dangling-link-probe branch from 97a8a79 to 66af19d Compare October 1, 2026 17:15
@qodo-code-review

qodo-code-review Bot commented Oct 1, 2026 •

Copy link
Copy Markdown

Code Review by Qodo

🐞 Bugs (0) 📘 Rule violations (0) 📜 Skill insights (0)

Grey Divider


Action required

1. The speed regression has no test guard ✗ Dismissed
Description
direct_dependency_link_dangling switches to .par_iter() without an added or modified test that
distinguishes this path from the sequential version. Reverting that line would leave the existing
dangling-link behavior tests passing, while the measured repeat-install slowdown could return.
Code

pnpm/crates/package-manager/src/optimistic_repeat_install/modules_dirs.rs[199]

+        .par_iter()
Relevance

●● Moderate

Nearby repeat-install correctness findings are accepted, but test-coverage requests have also been
rejected; no decisive parallelism precedent.

PR-#15569
PR-#16211

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
Rule 3365251 requires a regression test that fails without the fix. The diff changes only the probe
and a changeset, and the PR description says the existing tests pass unchanged; those tests cannot
distinguish .par_iter() from the prior .iter().

pnpm/crates/package-manager/src/optimistic_repeat_install/modules_dirs.rs[196-205]
Skill: review-code

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
The performance regression has no test that detects removal of the parallel probe.

## Fix Focus Areas
- pnpm/crates/package-manager/src/optimistic_repeat_install/modules_dirs.rs[196-205]

## Recommended Fix
Add a repeat-install performance regression test or benchmark with a documented check that distinguishes the parallel implementation from the sequential one.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools



Remediation recommended

2. The release note describes internals ✓ Resolved
Description
The changeset says pnpm checks dependency links in parallel, describing the implementation rather
than an observable change. The preceding sentence already states that repeat installs report
"Already up to date" faster, so the second sentence adds only internal detail to the release note.
Code

.changeset/parallel-dangling-link-probe.md[5]

+A repeat `pnpm install` in a large workspace reports "Already up to date" faster. pnpm now checks the direct dependency links of the workspace projects in parallel [#16487](https://github.com/pnpm/pnpm/issues/16487).
Relevance

●● Moderate

Similar changeset requests removing implementation detail were both accepted and rejected recently,
creating mixed precedent.

PR-#16238
PR-#16348

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
Rule 3058322 limits changeset text to observable behavior, while the second sentence on line 5
describes how the improvement is implemented.

Rule 3058322: Changeset entries must describe observable behavior changes only
.changeset/parallel-dangling-link-probe.md[5-5]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
The changeset includes an implementation detail rather than only observable behavior.

## Fix Focus Areas
- .changeset/parallel-dangling-link-probe.md[5-5]

## Recommended Fix
Remove the sentence about parallel link checks; keep the sentence describing the faster repeat install.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


Grey Divider

Context sources
✅ Compliance rules (platform): 63 rules
✅ Skills: review-code
Review mode: ⏭️ Skipped: The latest push only edits changeset release-note prose and has no behavioral or configuration impact.

Grey Divider

Tip of the day
💡 Did you know, you can keep summaries lean with Findings visible per group, which tucks the rest behind a View link

More tips ↗ | Customize Qodo ↗ | Qodo docs ↗

Grey Divider

Previous reviews

Review updated until commit babeb6c

Results up to commit 66af19d ⚖️ Balanced


🐞 Bugs (0) 📘 Rule violations (0) 📎 Requirement gaps (0) 🎨 UX issues (0) 🔗 Cross-repo conflicts (0) 📜 Skill insights (0)


Action required
1. The speed regression has no test guard ✗ Dismissed
Description
direct_dependency_link_dangling switches to .par_iter() without an added or modified test that
distinguishes this path from the sequential version. Reverting that line would leave the existing
dangling-link behavior tests passing, while the measured repeat-install slowdown could return.
Code

pnpm/crates/package-manager/src/optimistic_repeat_install/modules_dirs.rs[199]

+        .par_iter()
Relevance

●● Moderate

Nearby repeat-install correctness findings are accepted, but test-coverage requests have also been
rejected; no decisive parallelism precedent.

PR-#15569
PR-#16211

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
Rule 3365251 requires a regression test that fails without the fix. The diff changes only the probe
and a changeset, and the PR description says the existing tests pass unchanged; those tests cannot
distinguish .par_iter() from the prior .iter().

pnpm/crates/package-manager/src/optimistic_repeat_install/modules_dirs.rs[196-205]
Skill: review-code

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
The performance regression has no test that detects removal of the parallel probe.

## Fix Focus Areas
- pnpm/crates/package-manager/src/optimistic_repeat_install/modules_dirs.rs[196-205]

## Recommended Fix
Add a repeat-install performance regression test or benchmark with a documented check that distinguishes the parallel implementation from the sequential one.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools



Remediation recommended
2. The release note describes internals ✓ Resolved
Description
The changeset says pnpm checks dependency links in parallel, describing the implementation rather
than an observable change. The preceding sentence already states that repeat installs report
"Already up to date" faster, so the second sentence adds only internal detail to the release note.
Code

.changeset/parallel-dangling-link-probe.md[5]

+A repeat `pnpm install` in a large workspace reports "Already up to date" faster. pnpm now checks the direct dependency links of the workspace projects in parallel [#16487](https://github.com/pnpm/pnpm/issues/16487).
Relevance

●● Moderate

Similar changeset requests removing implementation detail were both accepted and rejected recently,
creating mixed precedent.

PR-#16238
PR-#16348

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
Rule 3058322 limits changeset text to observable behavior, while the second sentence on line 5
describes how the improvement is implemented.

Rule 3058322: Changeset entries must describe observable behavior changes only
.changeset/parallel-dangling-link-probe.md[5-5]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
The changeset includes an implementation detail rather than only observable behavior.

## Fix Focus Areas
- .changeset/parallel-dangling-link-probe.md[5-5]

## Recommended Fix
Remove the sentence about parallel link checks; keep the sentence describing the faster repeat install.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


Grey Divider

Qodo Logo

@qodo-code-review

Copy link
Copy Markdown

PR Code Suggestions ✨

Warning

/improve is deprecated. Use /agentic_review instead (removal date not yet scheduled).

No code suggestions found for the PR.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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-commenter

codecov-commenter commented Oct 1, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 92.20%. Comparing base (7afe7b9) to head (babeb6c).

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.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copilot AI balanced review requested due to automatic review settings October 1, 2026 17:28
@qodo-code-review

Copy link
Copy Markdown

Code review by qodo was updated up to the latest commit babeb6c

@qodo-code-review

Copy link
Copy Markdown

PR Code Suggestions ✨

Warning

/improve is deprecated. Use /agentic_review instead (removal date not yet scheduled).

No code suggestions found for the PR.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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

@zkochan

zkochan commented Oct 1, 2026

Copy link
Copy Markdown
Member

Review-and-fix pass:

  • Rebased onto main (no conflicts) and reviewed the change. The par_iter swap keeps behavior: the closure only reads the filesystem, any still short-circuits, and the result is a plain bool, so evaluation order does not matter. I found nothing to fix in the code.
  • Qodo, release note describing internals: valid. babeb6c removes the sentence about checking links in parallel and keeps the user-visible part.
  • Qodo, no perf regression test: declined. A test could only assert wall time, which would flake on CI. The benchmark table in the description is the reverted-patch evidence. I replied on the thread and resolved it.

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).

@zkochan
zkochan merged commit 3a2b33d into pnpm:main Oct 1, 2026
55 checks passed
@altaywtf
altaywtf deleted the perf/noop-install-dangling-link-probe branch October 2, 2026 04:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

product: pacquet reviewed: coderabbit CodeRabbit submitted an approving review state: automerge

Projects

None yet

Development

Successfully merging this pull request may close these issues.

No-op pnpm install in a large workspace is 2x slower since 12.7.0

4 participants