Skip to content

perf(resolving-deps-resolver): answer the hoist scope's ancestor queries per shared suffix - #13587

Merged
zkochan merged 3 commits into
mainfrom
perf-parallel-discovery
Aug 2, 2026
Merged

zkochan merged 3 commits into
mainfrom
perf-parallel-discovery

Conversation

@zkochan

@zkochan zkochan commented Aug 2, 2026 •

Copy link
Copy Markdown
Member

Summary

Deciding whether a missing-peer issue is already covered by another
importer's walk scans the issue's ancestor chain for a package that
importer owns. That scan ran per issue, and the issues reported for
one peer come from occurrences spread through the tree whose ancestor
chains share long suffixes — so the same suffix was rescanned once per
issue.

SharedChain is a cons-list whose links are shared, which is exactly
what makes the rescan avoidable: the answer for a link covers that link
and everything above it, for every chain built on it. any_memoized
records the answer per link, so the total cost is the number of distinct
links rather than the sum over chains. A suffix that already matched
spares each branch's own tip as well, since the fold short-circuits.

Per importer this takes O(issues × depth) to O(distinct links). The
issue count grows with the workspace, so the removed term is superlinear
in workspace size — multiplied by chain depth, which is what decides
whether it is visible.

Only the post-round scope filter memoizes, per peer name. I first
memoized the walk's own suppression check too; reviewers found that
unsound — a memo keyed on Arc::as_ptr outliving its links can answer
for whatever is allocated at that address next, and a walk allocates and
drops chain links throughout. That memo is gone, and measurement says
the walk never wanted it anyway (the fixture is faster without it). The
memo that remains holds an Arc to every link it keys on, so an entry
cannot outlive its link's address.

Measurements

Output is unchanged; 7,565 workspace tests pass.

workload main this PR
full-size resolution fixture (331 importers, chains 250 deep) 1.55 / 1.56 / 1.57s 1.18 / 1.20 / 1.20s
CI-sized fixture (chains 60 deep), as CI measured it 245.8 ± 0.64ms 238.5 ± 0.69ms (3%)
114-importer bit.cloud workspace (replay, interleaved ×3) 10.31s median 10.35s median (neutral)

I want to be straight about the last two rows. The win needs chains
deeper than either realistic workload has — deeper even than the
pathological chain from #13574, which was 15–26 packages. So
this is not a change users will time. What it buys is the removal of a
term that scales with the issue count, and the guarantee that a
deep-chain workspace cannot pay it quadratically. It measured
equal-or-better everywhere and slower nowhere.

The CI gate added in #13581 does register it — 3%, at its own
0.3% variance — though my local runs of that size were too noisy to see
it. Deepening its fixture to 150 layers separates the builds much more
clearly (573ms vs 663ms) but triples that group's cost on every PR,
which I did not think this was worth.

Squash Commit Body

Deciding whether a missing-peer issue is covered by another importer's
walk scans the issue's ancestor chain for a package that importer owns.
The scan ran per issue, and issues of one peer come from occurrences
spread through the tree whose chains share long suffixes, so the same
suffix was rescanned once per issue: O(issues x depth) per importer,
with the issue count growing with the workspace.

SharedChain already shares those suffixes structurally, so the answer
for a link covers that link and everything above it, for every chain
built on it. `any_memoized` records that answer per link, taking the
total to the number of distinct links; a suffix that already matched
spares each branch's own tip as well.

The post-round scope filter memoizes, per peer name; the walk's own
suppression check does not, because a memo outliving its links cannot
be keyed on their addresses and the walk drops chains throughout. Each
entry holds an `Arc` to the link it is keyed on, so an address cannot
be recycled underneath it.

Output is unchanged. On the full-size workspace resolution fixture,
whose chains are 250 deep, resolution goes from ~1.56s to ~1.19s, and
the CI-sized fixture moves 3%. It is neutral on the 114-importer
bit.cloud workspace, whose chains are too shallow for the rescan to
dominate: the term this removes scales with the issue count, but only
in proportion to chain depth.

Related to https://github.com/pnpm/pnpm/issues/13505.

Checklist

  • I checked the referenced issue and verified that none of the PRs
    already linked to it solves it.
  • The change is implemented in both the TypeScript CLI and the Rust
    pnpm/ port, or the description notes what still needs porting.
  • Added a changeset (pnpm changeset) if this PR changes any published
    package.
  • Added or updated tests.

Written by an agent (Claude Code, claude-opus-5).

Summary by CodeRabbit

  • Performance

    • Improved dependency resolution performance for projects with deeply chained workspaces.
    • Reused ancestor-chain checks to reduce repeated work during missing-peer dependency handling.
  • Bug Fixes

    • Preserved correct handling of locked peer dependencies while applying optimized resolution checks.
  • Tests

    • Added coverage confirming consistent results and safe reuse of cached dependency-chain evaluations.

zkochan added 2 commits August 2, 2026 14:54
…ies per shared suffix

Deciding whether a missing-peer issue is covered by another importer's
walk scans the issue's ancestor chain for a package that importer owns.
The scan ran per issue, and issues of one peer come from occurrences
spread through the tree whose chains share long suffixes, so the same
suffix was rescanned once per issue: `O(issues x depth)` per importer,
with the issue count growing with the workspace.

`SharedChain` already shares those suffixes structurally, so the answer
for a link covers that link and everything above it, for every chain
built on it. `any_memoized` records that answer per link, taking the
total to the number of distinct links; a suffix that already matched
spares each branch's own tip as well.

Both callers memoize: the post-round scope filter, per peer name, and
the walk's own suppression check, which holds one memo per peer name
for the walk (its scope is fixed for the walk's lifetime).

Output is unchanged. On the full-size workspace resolution fixture,
whose chains are 250 deep, resolution goes from ~1.56s to ~1.25s. It is
neutral on the 114-importer bit.cloud workspace and on the CI-sized
fixture, both of which have chains too shallow for the rescan to
dominate: the term this removes scales with the issue count, but only
in proportion to chain depth.

Related to https://github.com/pnpm/pnpm/issues/13505.
Copilot AI review requested due to automatic review settings August 2, 2026 13:00

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 was unable to review this pull request because the user who requested the review has reached their quota limit.

@coderabbitai

coderabbitai Bot commented Aug 2, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

The resolver adds memoized shared-chain suffix checks for missing-peer suppression. HoistMissingScope uses the memo during discovery, while tests validate result equivalence, reuse, isolation, and link lifetime retention.

Changes

Peer suppression memoization

Layer / File(s) Summary
Shared-chain suffix memoization
pnpm/crates/resolving-deps-resolver/src/resolve_peers/context.rs, pnpm/crates/resolving-deps-resolver/src/resolve_peers/context/tests.rs
Adds ChainSuffixMemo and SharedChain::any_memoized. Tests cover matching, non-matching, shared, isolated, and retained chain links.
Hoist missing-peer suppression
pnpm/crates/resolving-deps-resolver/src/resolve_peers.rs, pnpm/crates/resolving-deps-resolver/src/resolve_peers/discovery.rs, .changeset/hoist-scope-suffix-memo.md
Uses memoized ancestor-chain checks in apply_hoist_missing_scope. Locked peer names remain unsuppressed. Adds the patch changeset.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Possibly related PRs

Suggested labels: product: pacquet

Suggested reviewers: copilot

✨ Finishing Touches 💡 1
🛠️ Fix failing CI checks 💡
  • Create stacked PR
  • Commit on current branch
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch perf-parallel-discovery

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.

@qodo-code-review

Copy link
Copy Markdown

PR Summary by Qodo

Memoize hoist-scope ancestor scans per SharedChain suffix

✨ Enhancement 🧪 Tests ⚙️ Configuration changes 🕐 40+ Minutes

Grey Divider

AI Description

• Memoize hoist-scope ancestor-chain queries per SharedChain link to avoid rescanning suffixes.
• Reuse per-peer suffix memos in both post-discovery filtering and walk-time suppression.
• Add unit tests plus a changeset documenting deep-chain workspace performance improvement.
Diagram

graph TD
  W["Walker"] --> R["PeerDiscoveryResult"] --> A["apply_hoist_missing_scope"] --> HS["HoistMissingScope"] --> SC["SharedChain::any_memoized"] --> M[("ChainSuffixMemo")]
  W --> MIS["missing_issue_suppressed"] --> HS
Loading
High-Level Assessment

The PR’s approach (memoizing by SharedChain link identity) is the right fit because correctness depends on the full suffix structure (not just pkg_id values), and SharedChain already guarantees structural sharing. Considered alternatives like caching by pkg_id (incorrect across different ancestor paths) or storing memo state inside SharedChain links (complicates per-predicate validity) are either wrong or heavier than an external per-predicate memo.

Files changed (6) +161 / -22

Enhancement (4) +81 / -20
resolve_peers.rsRefactor hoist-scope suppression to memoize ancestor-chain coverage checks +18/-11

Refactor hoist-scope suppression to memoize ancestor-chain coverage checks

• Replaces per-issue ancestor iteration with a SharedChain-based 'suppresses_chain' that uses 'any_memoized' and a per-call memo. Extracts the coverage predicate into 'covers()' for reuse and clarity.

pnpm/crates/resolving-deps-resolver/src/resolve_peers.rs

context.rsAdd SharedChain::any_memoized and ChainSuffixMemo keyed by link identity +44/-0

Add SharedChain::any_memoized and ChainSuffixMemo keyed by link identity

• Adds a suffix memo (HashMap keyed by Arc pointer identity) and a memoized traversal that caches predicate satisfaction per shared suffix link. This enables amortizing repeated ancestor queries across many chains that share suffixes.

pnpm/crates/resolving-deps-resolver/src/resolve_peers/context.rs

discovery.rsMemoize hoist-scope filtering per peer during post-discovery issue retention +5/-2

Memoize hoist-scope filtering per peer during post-discovery issue retention

• Creates a per-peer 'ChainSuffixMemo' while filtering missing peer issues so shared ancestor suffixes are evaluated once across all occurrences of the same peer name.

pnpm/crates/resolving-deps-resolver/src/resolve_peers/discovery.rs

walker.rsCache missing-scope suffix verdicts per peer name across a walk +14/-7

Cache missing-scope suffix verdicts per peer name across a walk

• Adds 'missing_scope_memo' to 'Walker' and threads memo reuse through 'missing_issue_suppressed', changing it to '&mut self'. This avoids repeated ancestor scans for the same peer name during a single walk because the hoist_missing_scope is fixed for that walk.

pnpm/crates/resolving-deps-resolver/src/resolve_peers/walker.rs

Tests (1) +75 / -2
tests.rsAdd unit tests covering SharedChain suffix memo semantics and reuse behavior +75/-2

Add unit tests covering SharedChain suffix memo semantics and reuse behavior

• Introduces tests validating that 'any_memoized' matches the non-memoized answer, that shared suffix matches/negatives are evaluated once, and that memos are not reused across different predicates.

pnpm/crates/resolving-deps-resolver/src/resolve_peers/context/tests.rs

Other (1) +5 / -0
hoist-scope-suffix-memo.mdAdd changeset for hoist-scope suffix memo performance improvement +5/-0

Add changeset for hoist-scope suffix memo performance improvement

• Introduces a patch changeset describing faster resolution for workspaces with deep dependency chains due to suffix-level memoization of missing-peer suppression checks.

.changeset/hoist-scope-suffix-memo.md

@greptile-apps

greptile-apps Bot commented Aug 2, 2026 •

Copy link
Copy Markdown
Contributor

Confidence Score: 5/5

The PR appears safe to merge.

The previously reported pointer-key lifetime defect is fixed because every cached address is paired with an owning Arc that keeps the allocation alive until its memo is dropped, and no blocking failure remains.

Reviews (2): Last reviewed commit: "fix(resolving-deps-resolver): key the ch..." | Re-trigger Greptile

@coderabbitai coderabbitai Bot 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.

Actionable comments posted: 1

🧹 Nitpick comments (2)
.changeset/hoist-scope-suffix-memo.md (1)

5-5: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Describe the observable performance result.

Replace the cache implementation detail with a concise user-facing result, such as: Improve workspace resolution performance for deep dependency trees.

As per path instructions, changeset text must be concise and user-facing.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.changeset/hoist-scope-suffix-memo.md at line 5, Rewrite the changeset
description to be concise and user-facing, focusing on improved workspace
resolution performance for deep dependency trees. Remove implementation details
about caching, shared chain segments, and reports while preserving the
observable performance improvement.

Sources: Path instructions, Learnings

pnpm/crates/resolving-deps-resolver/src/resolve_peers/context/tests.rs (1)

159-162: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Remove the redundant doc comment.

The comment only restates the helper behavior. The helper name and implementation already define this behavior.

As per coding guidelines, comments must not restate code. As per path instructions, document only non-obvious invariants.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@pnpm/crates/resolving-deps-resolver/src/resolve_peers/context/tests.rs`
around lines 159 - 162, Remove the redundant doc comment above the chain_of
helper; leave the function name and implementation unchanged.

Sources: Coding guidelines, Path instructions

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@pnpm/crates/resolving-deps-resolver/src/resolve_peers/context.rs`:
- Around line 99-136: Update ChainSuffixMemo and SharedChain::any_memoized so
every memoized verdict retains the corresponding Arc<SharedChainLink<Element>>
alongside its result, preventing link addresses from being reused while cached.
Adjust lookups and inserts to validate the retained identity, and add a
regression test covering a dropped memoized branch followed by a distinct branch
with a different coverage result.

---

Nitpick comments:
In @.changeset/hoist-scope-suffix-memo.md:
- Line 5: Rewrite the changeset description to be concise and user-facing,
focusing on improved workspace resolution performance for deep dependency trees.
Remove implementation details about caching, shared chain segments, and reports
while preserving the observable performance improvement.

In `@pnpm/crates/resolving-deps-resolver/src/resolve_peers/context/tests.rs`:
- Around line 159-162: Remove the redundant doc comment above the chain_of
helper; leave the function name and implementation unchanged.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 22d65617-340f-4204-b429-02ae0405e781

📥 Commits

Reviewing files that changed from the base of the PR and between 99194c8 and ea0f007.

📒 Files selected for processing (6)
  • .changeset/hoist-scope-suffix-memo.md
  • pnpm/crates/resolving-deps-resolver/src/resolve_peers.rs
  • pnpm/crates/resolving-deps-resolver/src/resolve_peers/context.rs
  • pnpm/crates/resolving-deps-resolver/src/resolve_peers/context/tests.rs
  • pnpm/crates/resolving-deps-resolver/src/resolve_peers/discovery.rs
  • pnpm/crates/resolving-deps-resolver/src/resolve_peers/walker.rs

@qodo-code-review

qodo-code-review Bot commented Aug 2, 2026 •

Copy link
Copy Markdown

Code Review by Qodo

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

Context used
✅ Compliance rules (platform): 24 rules

Grey Divider


Action required

1. Pointer-key memo collision ✓ Resolved 🐞 Bug ≡ Correctness
Description
SharedChain::any_memoized keys memo entries by Arc allocation address (Arc::as_ptr as usize), but
Walker retains these memos across the whole walk; if a link is dropped and its address reused for a
different link later in the same walk, memo lookups can return a stale verdict and incorrectly
suppress/emit missing-peer issues.
Code

pnpm/crates/resolving-deps-resolver/src/resolve_peers/context.rs[R135-137]

+fn link_key<Element>(link: &Arc<SharedChainLink<Element>>) -> usize {
+    Arc::as_ptr(link) as usize
+}
Relevance

●● Moderate

Potentially real correctness risk, but no close repo precedent on pointer-address memo keys.

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
The memo key is derived solely from the link’s allocation address, and the memo is retained on the
Walker across the whole traversal while SharedChain links are continuously allocated (pushed) and
later dropped as recursion unwinds; this makes stale-pointer-key reuse possible and can skip
predicate evaluation for a different link that happens to reuse an address.

pnpm/crates/resolving-deps-resolver/src/resolve_peers/context.rs[79-87]
pnpm/crates/resolving-deps-resolver/src/resolve_peers/context.rs[95-137]
pnpm/crates/resolving-deps-resolver/src/resolve_peers/walker.rs[133-138]
pnpm/crates/resolving-deps-resolver/src/resolve_peers/walker.rs[697-703]

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

### Issue description
`ChainSuffixMemo` is keyed by `Arc::as_ptr(link) as usize`. Because the memo outlives individual `SharedChainLink` allocations (it is stored on `Walker` for the duration of the walk), pointer-address reuse after a link is freed can cause incorrect memo hits and wrong suppression decisions.

### Issue Context
This memo is meant to be valid structurally across many `SharedChain` instances, but the key must remain unique/stable even when earlier chain tips are dropped as recursion unwinds.

### Fix Focus Areas
- pnpm/crates/resolving-deps-resolver/src/resolve_peers/context.rs[65-137]
- pnpm/crates/resolving-deps-resolver/src/resolve_peers/walker.rs[133-138]
- pnpm/crates/resolving-deps-resolver/src/resolve_peers/walker.rs[1180-1191]

### Suggested fix approach
- Replace the pointer-as-`usize` key with a stable per-link identity that cannot collide after deallocation, e.g.:
 - add a `u64 id` field to `SharedChainLink` assigned from a module-level `AtomicU64`, and key the memo by that `id`; or
 - store an owned key that keeps the allocation alive for the memo lifetime (only if memory tradeoff is acceptable).
- Add a regression test that exercises many `pushed()` allocations and drops while reusing the memo (ideally forcing allocator reuse if possible) to validate correctness.

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



Remediation recommended

2. Changeset missing pnpm entry 📘 Rule violation § Compliance
Description
The newly added changeset only declares a bump for pacquet and does not include a pnpm entry.
This violates the changeset policy and can lead to missing or incorrect pnpm release metadata for
this change.
Code

.changeset/hoist-scope-suffix-memo.md[R1-3]

+---
+"pacquet": patch
+---
Relevance

●●● Strong

Repo frequently accepts fixes adding required pnpm entry to changesets for compliance.

PR-#13403
PR-#13337
PR-#12931

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
PR Compliance ID 713436 requires changeset front-matter to include a pnpm entry with a valid bump
type. The added changeset front-matter includes only "pacquet": patch and omits pnpm.

Rule 713436: Explicitly declare pnpm package and correct bump type in changesets
.changeset/hoist-scope-suffix-memo.md[1-3]

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 new changeset does not include a `pnpm` package entry in its front-matter.

## Issue Context
Per the compliance checklist, each new/modified changeset must explicitly declare a bump type for the `pnpm` package (`patch`/`minor`/`major`). This changeset currently lists only `pacquet`.

## Fix Focus Areas
- .changeset/hoist-scope-suffix-memo.md[1-3]

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


3. Memo memory amplification ✓ Resolved 🐞 Bug ➹ Performance
Description
Walker now retains a ChainSuffixMemo per peer name for the entire walk, so in large graphs the
retained memo state can grow substantially (roughly with the number of peer names that hit
suppression checks times the number of distinct chain links visited for those peers).
Code

pnpm/crates/resolving-deps-resolver/src/resolve_peers/walker.rs[R133-137]

+    /// Per peer name, the suffix verdicts
+    /// [`Self::missing_issue_suppressed`] has already computed against
+    /// this walk's [`ResolvePeersOptions::hoist_missing_scope`]. The
+    /// scope is fixed for the walk, so the answers stay valid for it.
+    missing_scope_memo: HashMap<String, ChainSuffixMemo>,
Relevance

●● Moderate

Memory-growth concern is plausible; repo history on memo/memory amplification is mixed.

PR-#12876
PR-#12458
PR-#13571

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
The Walker stores a per-peer memo map for the whole walk, and SharedChain::any_memoized inserts an
entry for each previously-unmemoized link encountered; this combination can retain many (peer, link)
verdicts in memory at once.

pnpm/crates/resolving-deps-resolver/src/resolve_peers/walker.rs[133-138]
pnpm/crates/resolving-deps-resolver/src/resolve_peers/context.rs[95-131]
pnpm/crates/resolving-deps-resolver/src/resolve_peers/walker.rs[1180-1191]

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

### Issue description
`Walker::missing_scope_memo` retains one `ChainSuffixMemo` per peer name until the end of the walk. Each call to `any_memoized` inserts entries for newly reached links, so peak memory can increase noticeably on large dependency graphs with many missing-peer names.

### Issue Context
This is an intentional time/memory tradeoff for deep-chain workspaces, but it’s worth ensuring the retained state can’t balloon unexpectedly on broad graphs.

### Fix Focus Areas
- pnpm/crates/resolving-deps-resolver/src/resolve_peers/walker.rs[133-138]
- pnpm/crates/resolving-deps-resolver/src/resolve_peers/walker.rs[1180-1191]
- pnpm/crates/resolving-deps-resolver/src/resolve_peers/context.rs[111-131]

### Suggested fix approach
- Consider bounding or scoping memo lifetime more tightly, for example:
 - clear `missing_scope_memo` when `hoist_missing_scope` is `None` or when starting a new walk instance (if reused anywhere),
 - or add a simple cap per peer name (e.g., stop memoizing after N distinct links and fall back to non-memoized scan),
 - or memoize only within the post-round filter (`apply_hoist_missing_scope`) if that covers most of the benefit.
- Add a stress test/benchmark (or debug assertion behind a feature) to track memo growth vs. distinct links on a synthetic wide+deep fixture.

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


4. Peer name reallocated ✓ Resolved 🐞 Bug ➹ Performance
Description
Walker::missing_issue_suppressed calls entry(peer_name.to_string()), which allocates a new String on
every call even when the memo already exists, adding avoidable overhead to the missing-peer hot
path.
Code

pnpm/crates/resolving-deps-resolver/src/resolve_peers/walker.rs[R1188-1190]

+        let Some(scope) = self.opts.hoist_missing_scope.clone() else { return false };
+        let memo = self.missing_scope_memo.entry(peer_name.to_string()).or_default();
+        scope.suppresses_chain(ancestor_pkg_ids, peer_name, memo)
Relevance

●● Moderate

Team sometimes accepts avoiding to_string() hot-path allocations, but often rejects
micro-optimizations; outcome uncertain.

PR-#12102
PR-#13455
PR-#12663

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
The new code allocates peer_name.to_string() unconditionally to perform the entry lookup, and
the call site is in the per-missing-peer resolution path (resolve_one_peer) which can execute many
times per walk.

pnpm/crates/resolving-deps-resolver/src/resolve_peers/walker.rs[1180-1191]
pnpm/crates/resolving-deps-resolver/src/resolve_peers/walker.rs[1241-1249]

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

### Issue description
`missing_issue_suppressed()` uses `self.missing_scope_memo.entry(peer_name.to_string())`, which constructs an owned `String` every time the function is called.

### Issue Context
This function is called for each missing peer occurrence during the walk; repeatedly allocating the key can partially offset the intended perf win from suffix memoization.

### Fix Focus Areas
- pnpm/crates/resolving-deps-resolver/src/resolve_peers/walker.rs[1180-1191]
- pnpm/crates/resolving-deps-resolver/src/resolve_peers/walker.rs[1241-1250]

### Suggested fix approach
- Avoid allocating an owned key unless the entry is actually absent, e.g.:
 - `let memo = if let Some(m) = self.missing_scope_memo.get_mut(peer_name) { m } else { self.missing_scope_memo.insert(peer_name.to_string(), ChainSuffixMemo::default()); self.missing_scope_memo.get_mut(peer_name).unwrap() };`
 - or use `raw_entry_mut()` / equivalent borrowed-key entry API if available in the chosen HashMap type.
- Also consider switching `self.opts.hoist_missing_scope.clone()` to `as_ref()` to avoid even the (cheap) Arc clone on this hot path.

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


Grey Divider

To customize comments, go to the Qodo configuration screen, or learn more in the docs.

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.

@github-actions

github-actions Bot commented Aug 2, 2026 •

Copy link
Copy Markdown
Contributor

Micro-Benchmark Results

Linux

group                                            main                                   pr
-----                                            ----                                   --
lockfile/parse_pnpm_lock                         1.02     11.2±0.02ms    33.4 MB/sec    1.00     11.0±0.02ms    34.0 MB/sec
packument/parse                                  1.00     38.0±0.11µs  1744.0 MB/sec    1.01     38.3±0.56µs  1733.3 MB/sec
tarball/download_dependency                      1.00      2.3±0.08ms  1906.6 KB/sec    1.03      2.3±0.05ms  1854.8 KB/sec
tarball_batch/cold_store_many_medium_tarballs    1.00    170.7±1.20ms 93.8 KElem/sec    1.01    171.9±2.52ms 93.1 KElem/sec
workspace_resolution/hoist_heavy                 1.03    242.2±0.53ms        ? ?/sec    1.00    235.3±0.70ms        ? ?/sec

@codecov-commenter

codecov-commenter commented Aug 2, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 87.99%. Comparing base (c2b2f15) to head (5fcc9d9).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main   #13587   +/-   ##
=======================================
  Coverage   87.98%   87.99%           
=======================================
  Files         563      563           
  Lines       97596    97636   +40     
=======================================
+ Hits        85874    85918   +44     
+ Misses      11722    11718    -4     

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

…eeps alive

An address identifies a link only while that link is alive, so a memo
keyed on `Arc::as_ptr` answers for whatever occupies the address now.
The walk-level memo held addresses for the length of a walk, which
allocates and drops chain links throughout: a recycled address would
have handed an unrelated chain a suppression verdict computed for a
dropped one, silently keeping or dropping a missing-peer report.

Drop that memo — it was also the one that had to allocate a `String`
per call to find its bucket, and measuring says the walk never needed
it: the fixture is faster without it, 1.25s to 1.19s. What remains is
the post-round filter, whose chains all predate it, and it now holds an
`Arc` to every link it keys on, so an entry cannot outlive its link's
address. The invariant is structural instead of a rule for callers to
remember.

Reported by three reviewers on #13587.
Copilot AI review requested due to automatic review settings August 2, 2026 13:16

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 was unable to review this pull request because the user who requested the review has reached their quota limit.

@zkochan

zkochan commented Aug 2, 2026

Copy link
Copy Markdown
Member Author

Good catch, and it was a real defect — fixed in 5fcc9d9. Three of the four findings share one root cause.

Pointer-key memo collision (Greptile P1, CodeRabbit, Qodo #1). Correct. An address identifies a link only while that link is alive. The post-round filter happened to be safe — its chains are all built before the fold and nothing allocates during it — but the Walker-level memo lived for a whole walk, which allocates and drops chain links continuously as recursion descends and unwinds. A recycled address would have applied a dropped chain's verdict to an unrelated one, silently keeping or dropping a missing-peer report.

Two changes:

  • The walk-level memo is gone. It was the unsound call site, and measurement says the walk never needed it: the full-size fixture is faster without it (1.25s → 1.19s), so it was pure overhead.
  • The remaining memo holds an Arc to every link it keys on, so an entry cannot outlive its link's address. That turns a rule callers must remember into a structural guarantee, with a test asserting the strong count after the caller's chain is dropped.

Peer name reallocated (Qodo #3) and Memo memory amplification (Qodo #4) were both properties of that same walk-level memo — the peer_name.to_string() per call to find its bucket, and its per-walk retained state. Both are gone with it.

Changeset missing (Qodo #2) is a false positive: .changeset/hoist-scope-suffix-memo.md is in the PR, targeting pacquet. Per AGENTS.md a Rust-only change must omit "pnpm", which in changesets always means the TypeScript CLI package.

Net effect improves: 1.56s → 1.19s (1.31x) on the full-size fixture. 7,565 tests pass; just ready and the pre-push gate are clean. The PR description's measurement table is updated.


Written by an agent (Claude Code, claude-opus-5).

@coderabbitai coderabbitai Bot 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.

🧹 Nitpick comments (1)
pnpm/crates/resolving-deps-resolver/src/resolve_peers/context/tests.rs (1)

159-160: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Remove or replace the helper comment.

The comment restates link_strong_count. Remove it, or document a non-obvious test invariant instead.

As per coding guidelines, comments must explain non-obvious invariants or rationale and must not restate the implementation.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@pnpm/crates/resolving-deps-resolver/src/resolve_peers/context/tests.rs`
around lines 159 - 160, Remove the redundant doc comment above the
link_strong_count helper, or replace it with a comment describing a non-obvious
test invariant or rationale rather than restating the function’s behavior.

Sources: Coding guidelines, Path instructions

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@pnpm/crates/resolving-deps-resolver/src/resolve_peers/context/tests.rs`:
- Around line 159-160: Remove the redundant doc comment above the
link_strong_count helper, or replace it with a comment describing a non-obvious
test invariant or rationale rather than restating the function’s behavior.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 8bad9ad1-90e0-4110-bd5b-120894157277

📥 Commits

Reviewing files that changed from the base of the PR and between ea0f007 and 5fcc9d9.

📒 Files selected for processing (4)
  • pnpm/crates/resolving-deps-resolver/src/resolve_peers.rs
  • pnpm/crates/resolving-deps-resolver/src/resolve_peers/context.rs
  • pnpm/crates/resolving-deps-resolver/src/resolve_peers/context/tests.rs
  • pnpm/crates/resolving-deps-resolver/src/resolve_peers/discovery.rs
🚧 Files skipped from review as they are similar to previous changes (3)
  • pnpm/crates/resolving-deps-resolver/src/resolve_peers/discovery.rs
  • pnpm/crates/resolving-deps-resolver/src/resolve_peers.rs
  • pnpm/crates/resolving-deps-resolver/src/resolve_peers/context.rs

@github-actions github-actions Bot added the reviewed: coderabbit CodeRabbit submitted an approving review label Aug 2, 2026
@qodo-code-review

Copy link
Copy Markdown

Code review by qodo was updated up to the latest commit 5fcc9d9

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

@github-actions

github-actions Bot commented Aug 2, 2026

Copy link
Copy Markdown
Contributor

Integrated-Benchmark Report (Linux)

Commit: 5fcc9d9232e8

Regular scenarios report direct and pnpr installs. The peer-heavy resolver scenario compares current Rust, main Rust, and TypeScript pnpm. Bencher consumes pacquet@HEAD and pnpr@HEAD.

The tables below show mean ± σ; Bencher thresholds on the minimum latency, which is far less perturbed by shared-runner contention (noise only adds time).

Scenario: Isolated linker: fresh restore, cold cache + cold store

Command Mean [s] Min [s] Max [s] Relative
pacquet@HEAD 2.443 ± 0.113 2.363 2.707 1.67 ± 0.18
pacquet@main 2.508 ± 0.163 2.361 2.806 1.71 ± 0.20
pnpr@HEAD 1.464 ± 0.138 1.357 1.741 1.00
pnpr@main 1.502 ± 0.156 1.341 1.725 1.03 ± 0.14
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 2.4428630573,
      "stddev": 0.11272344861897984,
      "median": 2.3808523316,
      "user": 1.5005592799999998,
      "system": 1.2729997600000003,
      "min": 2.3628078306,
      "max": 2.7070802906,
      "times": [
        2.3721275086,
        2.4585630576,
        2.7070802906,
        2.4521477286,
        2.3793420426000003,
        2.3823626206,
        2.3758942406,
        2.3628078306,
        2.3710683346,
        2.5672369186
      ]
    },
    {
      "command": "pacquet@main",
      "mean": 2.5078011010000005,
      "stddev": 0.16326611054961146,
      "median": 2.4324206896000002,
      "user": 1.4956112799999999,
      "system": 1.2648362599999998,
      "min": 2.3610961866,
      "max": 2.8055068906000002,
      "times": [
        2.7707838976,
        2.4267061346000003,
        2.3896949266000003,
        2.4381352446,
        2.3610961866,
        2.4140725206,
        2.3713601766,
        2.8055068906000002,
        2.5961228606,
        2.5045321716
      ]
    },
    {
      "command": "pnpr@HEAD",
      "mean": 1.4643591208999998,
      "stddev": 0.13798934280881964,
      "median": 1.3973038376,
      "user": 1.0436842800000001,
      "system": 1.1347189600000003,
      "min": 1.3571153046000002,
      "max": 1.7410893486,
      "times": [
        1.3577146536,
        1.3957361356,
        1.7410893486,
        1.3779630046000002,
        1.6638910246,
        1.3791861466,
        1.3571153046000002,
        1.4249854246,
        1.5470386266,
        1.3988715396
      ]
    },
    {
      "command": "pnpr@main",
      "mean": 1.5021206662000002,
      "stddev": 0.15600830776452695,
      "median": 1.4845592756000001,
      "user": 1.03992638,
      "system": 1.09657556,
      "min": 1.3411119756,
      "max": 1.7252627406,
      "times": [
        1.5668674786,
        1.3687707776,
        1.4022510726000001,
        1.6782162556000002,
        1.6410334406000002,
        1.6087379476,
        1.3462750456,
        1.7252627406,
        1.3411119756,
        1.3426799276
      ]
    }
  ]
}

Scenario: Isolated linker: fresh restore, hot cache + hot store

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 256.2 ± 5.8 245.3 265.7 1.03 ± 0.04
pacquet@main 248.6 ± 7.2 234.1 259.0 1.00
pnpr@HEAD 269.6 ± 5.7 260.6 278.7 1.08 ± 0.04
pnpr@main 268.2 ± 5.3 258.8 273.2 1.08 ± 0.04
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.25619657020000003,
      "stddev": 0.005787733595662651,
      "median": 0.25546764920000004,
      "user": 0.20368092,
      "system": 0.5177492399999999,
      "min": 0.2452716697,
      "max": 0.2657265757,
      "times": [
        0.25792162970000004,
        0.2657265757,
        0.25121878870000003,
        0.25559602070000004,
        0.25834568770000005,
        0.2549962707,
        0.25413260470000004,
        0.25533927770000003,
        0.2452716697,
        0.26341717670000003
      ]
    },
    {
      "command": "pacquet@main",
      "mean": 0.2485593956,
      "stddev": 0.007169396491932746,
      "median": 0.24821935570000003,
      "user": 0.19583431999999998,
      "system": 0.49631283999999987,
      "min": 0.23412275770000002,
      "max": 0.25899483970000003,
      "times": [
        0.2460653857,
        0.2518910737,
        0.25037332570000004,
        0.24527269170000002,
        0.24519195970000002,
        0.23412275770000002,
        0.2452014977,
        0.25899483970000003,
        0.25789505970000004,
        0.25058536470000004
      ]
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.26959564910000006,
      "stddev": 0.005714019463512499,
      "median": 0.2676315932,
      "user": 0.21411702,
      "system": 0.53454334,
      "min": 0.26060463170000003,
      "max": 0.27874956770000003,
      "times": [
        0.27874956770000003,
        0.26641509170000005,
        0.27465762270000005,
        0.2673723747,
        0.2669515927,
        0.2672371397,
        0.26060463170000003,
        0.27800692870000004,
        0.2680707297,
        0.2678908117
      ]
    },
    {
      "command": "pnpr@main",
      "mean": 0.26817019210000004,
      "stddev": 0.005310308443750249,
      "median": 0.2708519117,
      "user": 0.21259492,
      "system": 0.5164872400000001,
      "min": 0.25882500070000003,
      "max": 0.27322076770000003,
      "times": [
        0.2632564647,
        0.2620014117,
        0.25882500070000003,
        0.27125808170000004,
        0.26529520370000004,
        0.27322076770000003,
        0.27230658570000005,
        0.27211901270000005,
        0.2704457417,
        0.2729736507
      ]
    }
  ]
}

Scenario: Isolated linker: fresh install, cold cache + cold store

Command Mean [s] Min [s] Max [s] Relative
pacquet@HEAD 2.593 ± 0.015 2.562 2.615 1.69 ± 0.13
pacquet@main 2.593 ± 0.027 2.552 2.632 1.69 ± 0.13
pnpr@HEAD 1.537 ± 0.121 1.424 1.809 1.00
pnpr@main 1.599 ± 0.180 1.422 1.862 1.04 ± 0.14
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 2.5931027856799997,
      "stddev": 0.015288526013965803,
      "median": 2.59356068568,
      "user": 1.44767306,
      "system": 1.3150739399999998,
      "min": 2.56150754018,
      "max": 2.61508053718,
      "times": [
        2.58245353118,
        2.60771344518,
        2.60426036418,
        2.58687858418,
        2.58520843818,
        2.59130121118,
        2.60080404518,
        2.61508053718,
        2.56150754018,
        2.59582016018
      ]
    },
    {
      "command": "pacquet@main",
      "mean": 2.59296018218,
      "stddev": 0.02681564967854741,
      "median": 2.5963388516799997,
      "user": 1.4393790599999998,
      "system": 1.29831764,
      "min": 2.5519726871799997,
      "max": 2.6318211791799997,
      "times": [
        2.59477728618,
        2.56574290618,
        2.60364298018,
        2.5519726871799997,
        2.62939056218,
        2.56265469018,
        2.58758344218,
        2.59790041718,
        2.60411567118,
        2.6318211791799997
      ]
    },
    {
      "command": "pnpr@HEAD",
      "mean": 1.5370376651800002,
      "stddev": 0.12130432443799498,
      "median": 1.49785647118,
      "user": 1.0124275600000001,
      "system": 1.1417868399999995,
      "min": 1.42391180118,
      "max": 1.80914821018,
      "times": [
        1.47940364918,
        1.43121883918,
        1.42391180118,
        1.61666788518,
        1.48040308218,
        1.42621950518,
        1.5603540271799998,
        1.80914821018,
        1.51530986018,
        1.6277397921799999
      ]
    },
    {
      "command": "pnpr@main",
      "mean": 1.5992258590799997,
      "stddev": 0.17976698822499645,
      "median": 1.54945095568,
      "user": 1.02389426,
      "system": 1.1196775399999999,
      "min": 1.4219316491799998,
      "max": 1.86228788918,
      "times": [
        1.8052145181800001,
        1.53302009118,
        1.56588182018,
        1.61641636818,
        1.47366335118,
        1.86228788918,
        1.4331329521799998,
        1.4221202551799998,
        1.85858969618,
        1.4219316491799998
      ]
    }
  ]
}

Scenario: Isolated linker: fresh install, hot cache + hot store

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 395.9 ± 6.7 388.2 408.0 1.32 ± 0.04
pacquet@main 383.1 ± 4.4 376.4 392.2 1.28 ± 0.04
pnpr@HEAD 299.5 ± 8.2 286.6 311.4 1.00
pnpr@main 302.6 ± 6.7 291.2 311.8 1.01 ± 0.04
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.39592085596,
      "stddev": 0.006680856005778916,
      "median": 0.39414926646000004,
      "user": 0.4783182799999999,
      "system": 0.72004652,
      "min": 0.38823484046,
      "max": 0.40800358546,
      "times": [
        0.39033188846,
        0.39377937046,
        0.38823484046,
        0.39451916246,
        0.39005565846,
        0.39545155046,
        0.40653872646,
        0.40800358546,
        0.39853309246,
        0.39376068446
      ]
    },
    {
      "command": "pacquet@main",
      "mean": 0.38310514285999997,
      "stddev": 0.004369662541162958,
      "median": 0.38297759496,
      "user": 0.4979955799999999,
      "system": 0.6773980199999999,
      "min": 0.37637576946,
      "max": 0.39218345546,
      "times": [
        0.38020977846,
        0.38042340146000003,
        0.37637576946,
        0.38581671746,
        0.38601348746,
        0.38232690446,
        0.39218345546,
        0.38362828546,
        0.38422740446000003,
        0.37984622446
      ]
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.29953024436,
      "stddev": 0.00820620353122266,
      "median": 0.30033289846,
      "user": 0.19728067999999996,
      "system": 0.51810092,
      "min": 0.28660529946,
      "max": 0.31144093546,
      "times": [
        0.28660529946,
        0.29229145646,
        0.28866098046,
        0.29983456046,
        0.30893055846,
        0.30035461946,
        0.30165432646,
        0.31144093546,
        0.30521852946,
        0.30031117746
      ]
    },
    {
      "command": "pnpr@main",
      "mean": 0.30256025046000007,
      "stddev": 0.006651999331030397,
      "median": 0.30276772896000004,
      "user": 0.17445038000000002,
      "system": 0.5517518199999999,
      "min": 0.29122885546,
      "max": 0.31177577546,
      "times": [
        0.30706050746,
        0.30743040446000003,
        0.29122885546,
        0.29401643646,
        0.30362700246,
        0.30076798846,
        0.30935328546,
        0.30190845546,
        0.31177577546,
        0.29843379346
      ]
    }
  ]
}

Scenario: Isolated linker: fresh install, cold cache + hot store

Command Mean [s] Min [s] Max [s] Relative
pacquet@HEAD 1.729 ± 0.006 1.721 1.740 5.77 ± 0.11
pacquet@main 1.718 ± 0.004 1.711 1.725 5.73 ± 0.10
pnpr@HEAD 0.300 ± 0.005 0.292 0.307 1.00
pnpr@main 0.301 ± 0.010 0.283 0.319 1.00 ± 0.04
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 1.72887776042,
      "stddev": 0.006452310095906919,
      "median": 1.72826396432,
      "user": 0.7089734999999999,
      "system": 0.77430084,
      "min": 1.7212670243200001,
      "max": 1.74016675332,
      "times": [
        1.73440179732,
        1.7361267263200002,
        1.72782870032,
        1.72318548632,
        1.73094690132,
        1.72383961832,
        1.72869922832,
        1.7212670243200001,
        1.72231536832,
        1.74016675332
      ]
    },
    {
      "command": "pacquet@main",
      "mean": 1.7180064526199998,
      "stddev": 0.004410075720987899,
      "median": 1.71818554232,
      "user": 0.7043225,
      "system": 0.7442219399999999,
      "min": 1.7110615173200001,
      "max": 1.72540885332,
      "times": [
        1.7230258853200002,
        1.71563121232,
        1.72540885332,
        1.7110615173200001,
        1.71787682132,
        1.71471812232,
        1.7202802563200001,
        1.72009642032,
        1.71347117432,
        1.7184942633200002
      ]
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.29980292322,
      "stddev": 0.0054088742067792085,
      "median": 0.29870205782000003,
      "user": 0.18406730000000002,
      "system": 0.52396194,
      "min": 0.29241626032,
      "max": 0.30691691532000004,
      "times": [
        0.29445330632000005,
        0.29241626032,
        0.29853348032000004,
        0.30544354132,
        0.29373929232,
        0.30691691532000004,
        0.30356215932,
        0.29887063532,
        0.30618483732,
        0.29790880432000005
      ]
    },
    {
      "command": "pnpr@main",
      "mean": 0.30058239832000005,
      "stddev": 0.009905966637831781,
      "median": 0.29901219732000006,
      "user": 0.19288619999999998,
      "system": 0.52325404,
      "min": 0.28331101532,
      "max": 0.31903469432000003,
      "times": [
        0.28331101532,
        0.29552129832,
        0.29777290832000003,
        0.31903469432000003,
        0.29723805132000003,
        0.30925131232,
        0.30025148632000004,
        0.30561103632000003,
        0.29207602032,
        0.30575616032
      ]
    }
  ]
}

Scenario: Isolated linker: fresh resolve, hot cache, offline

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 180.0 ± 13.1 170.7 222.5 2.08 ± 0.16
pacquet@main 173.4 ± 3.3 168.7 179.7 2.01 ± 0.06
pnpr@HEAD 86.9 ± 2.1 82.6 91.6 1.01 ± 0.03
pnpr@main 86.4 ± 1.9 82.4 89.2 1.00
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.1800321220215385,
      "stddev": 0.013119525610075676,
      "median": 0.17668314256,
      "user": 0.1682755,
      "system": 0.06820259230769231,
      "min": 0.17067145256000002,
      "max": 0.22248291956000002,
      "times": [
        0.22248291956000002,
        0.17373107356,
        0.17067145256000002,
        0.18332337756,
        0.17672181656,
        0.18005471256,
        0.17749501256,
        0.17668314256,
        0.17612744656,
        0.17812076956,
        0.17546921756,
        0.17563124256,
        0.17390540256
      ]
    },
    {
      "command": "pacquet@main",
      "mean": 0.17342504420705884,
      "stddev": 0.0032518493909017543,
      "median": 0.17247452856,
      "user": 0.15960826470588232,
      "system": 0.06897307647058822,
      "min": 0.16871619056,
      "max": 0.17973832656,
      "times": [
        0.17156450356,
        0.17973832656,
        0.17247452856,
        0.17371263956,
        0.17441137456,
        0.17208333156,
        0.17920801756000002,
        0.17019567656,
        0.17717366656,
        0.17039991156,
        0.17436252256,
        0.16871619056,
        0.17135254456000001,
        0.17673218556,
        0.16991910556,
        0.17163477656,
        0.17454644956
      ]
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.08685390309125,
      "stddev": 0.0020761136897303584,
      "median": 0.08689353356,
      "user": 0.018915593750000004,
      "system": 0.01032446875,
      "min": 0.08259433356,
      "max": 0.09162453756,
      "times": [
        0.08767863656,
        0.08517935056,
        0.08750481956,
        0.08963473056,
        0.08513785256,
        0.08751344656,
        0.08744690056,
        0.08747643656,
        0.08679407156,
        0.08752258356,
        0.08695280056,
        0.08259433356,
        0.08830070856,
        0.08718741156,
        0.08680789756,
        0.08758703456,
        0.08630120356,
        0.08398108356,
        0.08864701056,
        0.08559073556,
        0.08996032456,
        0.08410435656,
        0.09162453756,
        0.08629489156,
        0.08475992056000001,
        0.09018261256,
        0.08614151256,
        0.08505029756,
        0.08683426656,
        0.08406949056,
        0.09002412356,
        0.08443951656
      ]
    },
    {
      "command": "pnpr@main",
      "mean": 0.08635433371625001,
      "stddev": 0.0019067704817463732,
      "median": 0.08677917805999999,
      "user": 0.0191888125,
      "system": 0.010096996874999998,
      "min": 0.08235658556,
      "max": 0.08918143656000001,
      "times": [
        0.08738978356,
        0.08551653556,
        0.08269533356,
        0.08785879656000001,
        0.08816262856,
        0.08710266256,
        0.08595274656,
        0.08308216156,
        0.08756620556,
        0.08608283256,
        0.08245516056,
        0.08837898556,
        0.08615999756,
        0.08298378656,
        0.08235658556,
        0.08334930556,
        0.08658964656,
        0.08755580556,
        0.08752430656,
        0.08918143656000001,
        0.08618113756,
        0.08647081256,
        0.08785769456,
        0.08708629156,
        0.08830975556,
        0.08656193456,
        0.08758937956,
        0.08667188056,
        0.08688647556,
        0.08773813856,
        0.08774539356,
        0.08629508156
      ]
    }
  ]
}

Scenario: Isolated linker: peer-heavy resolve, hot cache, offline

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 793.5 ± 176.7 554.1 1137.7 1.00
pacquet@main 859.1 ± 264.9 584.8 1264.0 1.08 ± 0.41
pnpm@HEAD 2909.8 ± 57.3 2805.0 2975.9 3.67 ± 0.82
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.7934521282777778,
      "stddev": 0.1767249451973417,
      "median": 0.7836260355,
      "user": 0.7375264933333332,
      "system": 0.16867620444444442,
      "min": 0.5541144385,
      "max": 1.1376802225,
      "times": [
        0.7836260355,
        0.9320211915000001,
        1.1376802225,
        0.6259164395,
        0.7172114185,
        0.8143647405000001,
        0.6870623345,
        0.5541144385,
        0.8890723335
      ]
    },
    {
      "command": "pacquet@main",
      "mean": 0.8590639028333333,
      "stddev": 0.26487579731797095,
      "median": 0.7102249835,
      "user": 0.8069269377777776,
      "system": 0.1756952044444444,
      "min": 0.5848340765,
      "max": 1.2639900474999999,
      "times": [
        0.5848340765,
        1.0421056535,
        0.7009514185,
        1.2627604024999999,
        0.7102249835,
        0.8423778625,
        1.2639900474999999,
        0.6439707785000001,
        0.6803599025
      ]
    },
    {
      "command": "pnpm@HEAD",
      "mean": 2.9097861530555558,
      "stddev": 0.057324624085112984,
      "median": 2.9225005385,
      "user": 4.409064271111111,
      "system": 0.2736854266666666,
      "min": 2.8049659665,
      "max": 2.9759115775000002,
      "times": [
        2.9558061755000002,
        2.9759115775000002,
        2.8435558355,
        2.8049659665,
        2.8761131755,
        2.9225005385,
        2.9592158675,
        2.9144478935,
        2.9355583475
      ]
    }
  ]
}

Scenario: Isolated linker: fresh restore, cold cache + cold store + cold pnpr

Command Mean [s] Min [s] Max [s] Relative
pacquet@HEAD 4.528 ± 0.121 4.409 4.784 1.28 ± 0.05
pacquet@main 4.602 ± 0.145 4.410 4.832 1.30 ± 0.05
pnpr@HEAD 3.529 ± 0.085 3.451 3.685 1.00
pnpr@main 3.564 ± 0.136 3.428 3.800 1.01 ± 0.05
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 4.52848711956,
      "stddev": 0.1210657301776986,
      "median": 4.51074347926,
      "user": 1.6739746999999998,
      "system": 1.3362377799999998,
      "min": 4.40937669826,
      "max": 4.78382387026,
      "times": [
        4.40937669826,
        4.54868334826,
        4.52066771226,
        4.68518325826,
        4.40959594926,
        4.432125543260001,
        4.52350480326,
        4.471090766260001,
        4.78382387026,
        4.50081924626
      ]
    },
    {
      "command": "pacquet@main",
      "mean": 4.60163923146,
      "stddev": 0.14485070126355393,
      "median": 4.58973266226,
      "user": 1.6748655999999997,
      "system": 1.3494045799999999,
      "min": 4.41009724426,
      "max": 4.83227446326,
      "times": [
        4.66355986026,
        4.64789925026,
        4.81528537426,
        4.56430319826,
        4.58726961426,
        4.83227446326,
        4.41009724426,
        4.59219571026,
        4.43284838626,
        4.47065921326
      ]
    },
    {
      "command": "pnpr@HEAD",
      "mean": 3.5291315288600003,
      "stddev": 0.08464733027010335,
      "median": 3.4981249987600003,
      "user": 1.1646985,
      "system": 1.21124778,
      "min": 3.4512794062600003,
      "max": 3.6851423062600004,
      "times": [
        3.4512794062600003,
        3.4600011902600003,
        3.4528434812600004,
        3.6851423062600004,
        3.51135032126,
        3.60563915126,
        3.4848996762600004,
        3.6231553352600003,
        3.56174547726,
        3.45525894326
      ]
    },
    {
      "command": "pnpr@main",
      "mean": 3.56431947396,
      "stddev": 0.1363802110906505,
      "median": 3.4886830907600004,
      "user": 1.1761171,
      "system": 1.20479738,
      "min": 3.42778504826,
      "max": 3.80000669026,
      "times": [
        3.80000669026,
        3.4995352752600004,
        3.5993033112600004,
        3.45350781526,
        3.4778309062600004,
        3.42778504826,
        3.4661152142600002,
        3.47408630426,
        3.7322506652600005,
        3.7127735092600003
      ]
    }
  ]
}

@github-actions

github-actions Bot commented Aug 2, 2026

Copy link
Copy Markdown
Contributor

🐰 Bencher Report

Projectpnpm's project
Branchpr/13587
Testbedpacquet
Click to view all benchmark results
BenchmarkLatencyBenchmark Result
milliseconds (ms)
(Result Δ%)
Upper Boundary
milliseconds (ms)
(Limit %)
isolated-linker.fresh-install.cold-cache.cold-store📈 view plot
🚷 view threshold
2,561.51 ms
(-1.87%)Baseline: 2,610.30 ms
3,132.36 ms
(81.78%)
isolated-linker.fresh-install.cold-cache.hot-store📈 view plot
🚷 view threshold
1,721.27 ms
(-1.95%)Baseline: 1,755.54 ms
2,106.65 ms
(81.71%)
isolated-linker.fresh-install.hot-cache.hot-store📈 view plot
🚷 view threshold
388.23 ms
(-5.91%)Baseline: 412.62 ms
495.15 ms
(78.41%)
isolated-linker.fresh-resolve.hot-cache.offline📈 view plot
🚷 view threshold
170.67 ms
(-10.73%)Baseline: 191.18 ms
229.42 ms
(74.39%)
isolated-linker.fresh-restore.cold-cache.cold-store📈 view plot
🚷 view threshold
2,362.81 ms
(-0.90%)Baseline: 2,384.35 ms
2,861.22 ms
(82.58%)
isolated-linker.fresh-restore.cold-cache.cold-store.cold-pnpr📈 view plot
🚷 view threshold
4,409.38 ms
(-1.33%)Baseline: 4,468.79 ms
5,362.55 ms
(82.23%)
isolated-linker.fresh-restore.hot-cache.hot-store📈 view plot
🚷 view threshold
245.27 ms
(-4.58%)Baseline: 257.03 ms
308.44 ms
(79.52%)
isolated-linker.peer-heavy-resolve.hot-cache.offline📈 view plot
🚷 view threshold
554.11 ms
(-44.90%)Baseline: 1,005.60 ms
1,206.72 ms
(45.92%)
🐰 View full continuous benchmarking report in Bencher

@github-actions

github-actions Bot commented Aug 2, 2026

Copy link
Copy Markdown
Contributor

🐰 Bencher Report

Projectpnpm's project
Branchpr/13587
Testbedpnpr

⚠️ WARNING: No Threshold found!

Without a Threshold, no Alerts will ever be generated.

Click here to create a new Threshold
For more information, see the Threshold documentation.
To only post results if a Threshold exists, set the --ci-only-thresholds flag.

Click to view all benchmark results
BenchmarkLatencymilliseconds (ms)
isolated-linker.fresh-install.cold-cache.cold-store📈 view plot
⚠️ NO THRESHOLD
1,423.91 ms
isolated-linker.fresh-install.cold-cache.hot-store📈 view plot
⚠️ NO THRESHOLD
292.42 ms
isolated-linker.fresh-install.hot-cache.hot-store📈 view plot
⚠️ NO THRESHOLD
286.61 ms
isolated-linker.fresh-resolve.hot-cache.offline📈 view plot
⚠️ NO THRESHOLD
82.59 ms
isolated-linker.fresh-restore.cold-cache.cold-store📈 view plot
⚠️ NO THRESHOLD
1,357.12 ms
isolated-linker.fresh-restore.cold-cache.cold-store.cold-pnpr📈 view plot
⚠️ NO THRESHOLD
3,451.28 ms
isolated-linker.fresh-restore.hot-cache.hot-store📈 view plot
⚠️ NO THRESHOLD
260.60 ms
🐰 View full continuous benchmarking report in Bencher

@zkochan
zkochan merged commit 7347789 into main Aug 2, 2026
44 of 46 checks passed
@zkochan
zkochan deleted the perf-parallel-discovery branch August 2, 2026 13:42
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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants