Skip to content

perf(resolving-deps-resolver): amortize the per-importer workspace scans in the hoist loop - #13579

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

zkochan merged 3 commits into
mainfrom
perf-parallel-peer-phase

Conversation

@zkochan

@zkochan zkochan commented Aug 2, 2026 •

Copy link
Copy Markdown
Member

Summary

Two amortizations in the peer-hoist loop, for
pnpm/tasks#16. Together they take the
hoist-heavy resolution benchmark (331 importers, 5,030 packages) from
6.7s to 1.50s.

I profiled main first, because the budget in the issue predates
#13571 and #13575 and no longer holds:

item time share
discovery walks (662) 2.95s 44%
freeing each round's flattened missing-peer map 1.27s 19%
re-snapshotting two workspace maps per importer 1.13s 17%
owner-scope barrier snapshot 0.37s 6%
final peer pass 0.40s 6%
everything else 0.53s 8%

The final peer pass — one of the two parallelization targets the issue
names — is 6% of the resolve today. The two items above it are both
per-importer rescans of the whole workspace, and both come out without
touching what resolves or adding a thread.

Shared snapshots of the owner-scope maps

Every hoist round of every importer cloned first_importer_by_pkg and
first_walk_missing_by_pkg whole to build its HoistMissingScope, so a
round cost the workspace and a wave cost its square.

Each map now carries the Arc snapshot last projected from it, handed
out until a write invalidates it. The two writers that usually find
nothing to change — an ownership claim re-recording the importer that
already owns the package, and a later round re-recording a missing-peer
report the same owner generation already wrote — test before writing, so
a round that changes nothing reuses the projection. Snapshots already
issued keep what they were built from when a later write invalidates the
cache.

6.7s → 4.4s.

No flattened missing-peer map per round

Each discovery pass folded its subtree summaries into an owned pkg id → missing peer names map, cloning every descendant's package id and name
set into it. Its one consumer — the per-package owner-context record —
read that map and dropped it. On the benchmark the passes built 1.6M
entries and spent 1.1s freeing them again.

The summaries are already shared bottom-up by Arc, so a pass reports
its roots and the reader indexes them. The index borrows the names in
place, which makes it free to drop; the union that a package's several
occurrences require is materialized only when a second summary reports
the same package.

4.4s → 1.5s.

Results

In-repo workspace_full_resolution, three runs each:

scenario main this PR
hoist-heavy workspace resolution 6.66 / 6.75 / 6.85s 1.50 / 1.50 / 1.50s
peer-heavy workspace resolution 0.83 / 0.83 / 0.87s 0.84 / 0.85 / 0.84s
full workspace resolution 0.32 / 0.33 / 0.34s 0.32 / 0.33 / 0.33s

The two scenarios that never enter the hoist loop are unchanged, as
expected — see the note on pnpm/tasks#16 about which scenario
discriminates hoist-round work.

On the 114-importer bit.cloud workspace from the issue the gain is small,
because only ~0.2s of its resolve is the work this removes (its importers
mostly have their peers provided, so the per-round maps are small):

phase main this PR
importer inits 1.44s 1.39s
prepare initial rounds 0.94s 0.90s
owner-scope barrier 0.042s 0.043s
complete initial rounds 2.65s 2.42s
optional/required hoist loop 0.82s 0.87s
merged snapshot + collect 0.16s 0.16s
final peer pass 2.48s 2.52s
total replay 10.48s 10.19s

Peak memory falls as well: one shared snapshot replaces the per-importer
copies, and the flattened maps are never built (6.24 GB → 6.33 GB peak
RSS on that workspace, i.e. unchanged within noise, since its maps were
small to begin with).

On proving the output is unchanged

Both changes are meant to be output-preserving, and the 7,557 workspace
tests — which include the lockfile-shape and peer-resolution suites —
pass.

I could not gate that with lockfile byte-identity on the bit.cloud
workspace, because main itself is not run-to-run deterministic there:
two consecutive replays of the same main binary over the same restored
input differ by 10,390 lines, and main-vs-this-branch (5,336 lines) is
smaller than either build's own run-to-run noise. I have reopened
#13567 with the measurement.

Squash Commit Body

Two per-importer rescans of the whole workspace came out of the
peer-hoist loop, which made a hoist wave cost the square of the
workspace rather than the workspace.

Every round of every importer cloned `first_importer_by_pkg` and
`first_walk_missing_by_pkg` whole to build its `HoistMissingScope`.
Each map now carries the `Arc` snapshot last projected from it and
hands that out until a write invalidates it; the two writers that
usually change nothing — an ownership claim re-recording the importer
that already owns the package, and a later round re-recording a
missing-peer report the same owner generation already wrote — test
before writing, so a round that changes nothing reuses the projection.
Snapshots already issued keep what they were built from.

Each discovery pass also folded its subtree summaries into an owned
`pkg id -> missing peer names` map, cloning every descendant's package
id and name set into it, for one consumer that read the map and
dropped it: on the benchmark below, 1.6M entries built and 1.1s spent
freeing them. The summaries are already shared bottom-up by `Arc`, so
a pass now reports its roots and the reader indexes them in place. The
index borrows the names, which makes it free to drop, and the union
several occurrences of one package require is materialized only when a
second summary reports that package.

The hoist-heavy `workspace_full_resolution` scenario (331 importers,
5,030 packages) drops from ~6.7s to ~1.50s; the two scenarios that
never enter the hoist loop are unchanged. On the 114-importer
bit.cloud workspace from the issue the gain is ~0.2s of a 10.4s
resolve, since its importers mostly have their peers provided and its
per-round maps are small.

Related to https://github.com/pnpm/tasks/issues/16.

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. Keep it short and written for pnpm users — it becomes a release note.
  • Added or updated tests.

Written by an agent (Claude Code, claude-opus-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

    • Improved workspace installation performance by avoiding repeated scans during peer dependency resolution.
    • Reduced resolution scaling from quadratic to linear as workspace size grows.
    • Reduced redundant copying when processing missing peer dependency information.
  • Bug Fixes

    • Improved consistency when tracking missing peer names across shared dependency trees.
    • Preserved accurate dependency resolution results when package information is reused across workspace projects.

Copilot AI review requested due to automatic review settings August 2, 2026 09:21

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

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 166938ce-5ea0-41de-a25e-248dd9eccb6f

📥 Commits

Reviewing files that changed from the base of the PR and between 032c6d3 and 41d3f4a.

📒 Files selected for processing (9)
  • .changeset/amortize-hoist-round-workspace-scans.md
  • pnpm/crates/resolving-deps-resolver/src/resolve_dependency_tree/workspace_ctx.rs
  • pnpm/crates/resolving-deps-resolver/src/resolve_dependency_tree/workspace_ctx/tests.rs
  • pnpm/crates/resolving-deps-resolver/src/resolve_importer.rs
  • pnpm/crates/resolving-deps-resolver/src/resolve_peers.rs
  • pnpm/crates/resolving-deps-resolver/src/resolve_peers/discovery.rs
  • pnpm/crates/resolving-deps-resolver/src/resolve_peers/walker.rs
  • pnpm/crates/resolving-deps-resolver/src/resolve_peers/walker/tests.rs
  • pnpm/crates/resolving-deps-resolver/src/resolve_workspace.rs
🚧 Files skipped from review as they are similar to previous changes (9)
  • .changeset/amortize-hoist-round-workspace-scans.md
  • pnpm/crates/resolving-deps-resolver/src/resolve_workspace.rs
  • pnpm/crates/resolving-deps-resolver/src/resolve_dependency_tree/workspace_ctx/tests.rs
  • pnpm/crates/resolving-deps-resolver/src/resolve_importer.rs
  • pnpm/crates/resolving-deps-resolver/src/resolve_peers/discovery.rs
  • pnpm/crates/resolving-deps-resolver/src/resolve_peers/walker/tests.rs
  • pnpm/crates/resolving-deps-resolver/src/resolve_peers/walker.rs
  • pnpm/crates/resolving-deps-resolver/src/resolve_peers.rs
  • pnpm/crates/resolving-deps-resolver/src/resolve_dependency_tree/workspace_ctx.rs

📝 Walkthrough

Walkthrough

Peer discovery now retains shared missing summaries and indexes names without eagerly cloning maps. Workspace ownership and missing-peer data use cached Arc snapshots. Importer resolution reuses these snapshots across peer-hoist rounds.

Changes

Workspace peer-resolution optimization

Layer / File(s) Summary
Missing-summary indexing
pnpm/crates/resolving-deps-resolver/src/resolve_peers/{discovery.rs,walker.rs}, pnpm/crates/resolving-deps-resolver/src/resolve_peers.rs, pnpm/crates/resolving-deps-resolver/src/resolve_peers/walker/tests.rs
Discovery stores deduplicated MissingSummary references. index_missing_names indexes borrowed names across summary trees. Tests cover shared descendants and name unions.
Workspace snapshot state
pnpm/crates/resolving-deps-resolver/src/resolve_dependency_tree/workspace_ctx.rs, pnpm/crates/resolving-deps-resolver/src/resolve_dependency_tree/workspace_ctx/tests.rs
SnapshotCell caches owner and first-walk missing-peer maps. Writes invalidate snapshots only when records change. Tests validate copy-on-write and no-op reuse.
Resolver wiring and release metadata
pnpm/crates/resolving-deps-resolver/src/resolve_importer.rs, pnpm/crates/resolving-deps-resolver/src/resolve_workspace.rs, .changeset/amortize-hoist-round-workspace-scans.md
Importer resolution consumes indexed summaries and shared workspace maps without additional Arc allocations. The changeset records the patch release.

Estimated code review effort: 4 (Complex) | ~45 minutes

Possibly related PRs

  • pnpm/pnpm#13491: Follows the same peer-hoist discovery path and introduces related workspace map caching.
  • pnpm/pnpm#13506: Optimizes large-workspace peer resolution by reducing repeated workspace and peer discovery scans.
  • pnpm/pnpm#13551: Extends the same resolve_peers and WorkspaceTreeCtx missing-peer handling paths.

Suggested labels: product: pacquet

Suggested reviewers: copilot

✨ Finishing Touches
📝 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-peer-phase

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

Perf: amortize peer-hoist workspace scans via shared snapshots and missing-peer indexing

✨ Enhancement 🧪 Tests 📝 Documentation 🕐 40+ Minutes

Grey Divider

AI Description

• Cache shared owner-scope snapshots to avoid per-importer map cloning each hoist round.
• Index missing-peer summaries by borrowing from shared subtrees instead of flattening per round.
• Add unit tests validating snapshot invalidation/reuse and missing-peer union semantics.
Diagram

graph TD
  A["ImporterHoistState"] --> B["PeerHoistDiscovery"] --> C["MissingSummary (Arc)"] --> D["index_missing_names()"] --> E["WorkspaceTreeCtx"]
  E --> F["SnapshotCell cache"] --> G["HoistMissingScope"]
  A --> G
  subgraph Legend
    direction LR
    _m["Module"] ~~~ _ds["Cached data"]
  end
Loading
High-Level Assessment

The following are alternative approaches to this PR:

1. Persistent immutable maps (e.g., im::HashMap) for snapshots
  • ➕ Snapshots become cheap structural shares by default
  • ➕ Eliminates manual snapshot invalidation logic
  • ➖ Introduces dependency and likely higher constant factors on writes/lookups
  • ➖ May regress memory/layout vs std HashMap in hot paths
2. Maintain incremental per-package missing-peer index in WorkspaceTreeCtx
  • ➕ Avoids building an index each round entirely
  • ➕ Can update only on changed subtree summaries
  • ➖ Harder correctness story (needs precise invalidation on ownership rewrites)
  • ➖ More shared mutable state; higher complexity and lock contention risk

Recommendation: Current approach is a good balance: SnapshotCell removes quadratic full-map cloning without changing observable results, and indexing MissingSummary roots leverages existing Arc sharing while keeping the per-round derived view cheap. The alternatives either add dependencies/overhead (persistent maps) or substantially increase shared-state complexity (incremental global index).

Files changed (9) +265 / -72

Enhancement (3) +145 / -48
workspace_ctx.rsCache owner-scope map snapshots with SnapshotCell +83/-27

Cache owner-scope map snapshots with SnapshotCell

• Wraps owner-scope maps in a SnapshotCell that caches an Arc snapshot until invalidated by mutation. Updates first_importer_by_pkg/first_walk_missing_by_pkg APIs to return shared Arc snapshots and adjusts missing-peer recording to avoid unnecessary writes and cloning.

pnpm/crates/resolving-deps-resolver/src/resolve_dependency_tree/workspace_ctx.rs

discovery.rsReturn missing-peer summaries instead of flattening per-package map +14/-10

Return missing-peer summaries instead of flattening per-package map

• Replaces per-pass construction of an owned missing_names_by_pkg map with a Vec of unique Arc<MissingSummary> roots. Ensures summaries are deduplicated by Arc pointer equality to preserve sharing.

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

walker.rsAdd borrowed MissingNames and index_missing_names() +48/-11

Add borrowed MissingNames and index_missing_names()

• Introduces MissingNames (One/Union) to represent missing-peer name sets by reference, and index_missing_names() to build a per-package index by traversing summary DAGs without copying. Exposes MissingSummary and adds test module hook-up.

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

Refactor (3) +10 / -12
resolve_importer.rsRecord missing peers from indexed subtree summaries +7/-10

Record missing peers from indexed subtree summaries

• Switches required-round bookkeeping to index missing-peer names from shared discovery summaries and passes that view into WorkspaceTreeCtx recording. Avoids cloning owner-scope maps when building HoistMissingScope by consuming Arc snapshots directly.

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

resolve_peers.rsRe-export missing-peer indexing helpers +1/-0

Re-export missing-peer indexing helpers

• Re-exports MissingNames and index_missing_names from the walker module to make the borrowed indexing available to importer/ctx code.

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

resolve_workspace.rsReuse workspace owner-scope snapshots across importer barrier +2/-2

Reuse workspace owner-scope snapshots across importer barrier

• Uses WorkspaceTreeCtx’s Arc-returning snapshot APIs directly when building the shared owner-missing scope at the initial barrier, avoiding extra Arc allocations and cloning.

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

Tests (2) +105 / -12
tests.rsUpdate missing-peer recording tests and add snapshot sharing test +52/-12

Update missing-peer recording tests and add snapshot sharing test

• Refactors tests to use the new borrowed MissingNames/indexing model. Adds a unit test ensuring snapshots are reused when writes are no-ops and invalidated when content changes.

pnpm/crates/resolving-deps-resolver/src/resolve_dependency_tree/workspace_ctx/tests.rs

tests.rsAdd unit tests for missing-peer summary indexing +53/-0

Add unit tests for missing-peer summary indexing

• Adds tests verifying that indexing traverses all descendants across multiple roots and that duplicate package occurrences union their missing-peer names.

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

Documentation (1) +5 / -0
amortize-hoist-round-workspace-scans.mdAdd changeset documenting faster peer-hoist workspace installs +5/-0

Add changeset documenting faster peer-hoist workspace installs

• Adds a release note describing the performance improvement for workspaces with auto-installed peers by removing per-project workspace rescans in the peer-hoist loop.

.changeset/amortize-hoist-round-workspace-scans.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.

No blocking failure remains.

Reviews (2): Last reviewed commit: "test(resolving-deps-resolver): cover the..." | Re-trigger Greptile

@qodo-code-review

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

Copy link
Copy Markdown

Code Review by Qodo

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

Context used
✅ Compliance rules (platform): 24 rules

Grey Divider


Remediation recommended

1. Quadratic summary dedupe 🐞 Bug ➹ Performance ⭐ New
Description
In discover_peers(), MissingSummary roots are deduplicated by linearly scanning
result.missing_summaries for every NodeOutput, which becomes O(k²) in the number of summaries
considered in a single discovery pass. On hoist-heavy workspaces with many distinct direct-dep
outputs, this can add avoidable CPU back onto the peer-hoist hot path.
Code

pnpm/crates/resolving-deps-resolver/src/resolve_peers/discovery.rs[R185-188]

+        if let Some(summary) = output.subtree_missing_by_pkg
+            && !result.missing_summaries.iter().any(|seen| Arc::ptr_eq(seen, &summary))
+        {
+            result.missing_summaries.push(summary);
Relevance

●●● Strong

Perf-focused repo often accepts hot-path allocation/complexity improvements; similar O(N) hot-path
optimization was accepted.

PR-#13431

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
The new code checks for duplicates with a vector scan (iter().any(...)) before pushing, and this
happens inside fold_output, which is invoked once per resolved direct dependency in both the
own_direct and provider_direct loops—so total work grows with the square of the number of distinct
summaries encountered in that pass.

pnpm/crates/resolving-deps-resolver/src/resolve_peers/discovery.rs[181-224]

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

## Issue description
`discover_peers()` deduplicates `Arc<MissingSummary>` by scanning `result.missing_summaries` with `iter().any(Arc::ptr_eq(...))` for every output. This is linear per output and can become quadratic over the discovery pass.

## Issue Context
This code runs in the peer discovery path; the PR’s goal is to keep peer-hoist work linear in workspace size. The prior approach already used pointer-identity sets elsewhere (e.g., in `index_missing_names`) to keep dedupe O(1) amortized.

## Fix Focus Areas
- pnpm/crates/resolving-deps-resolver/src/resolve_peers/discovery.rs[181-189]

### Concrete change
Introduce a local `seen_missing_summaries: HashSet<usize>` (prefer `FxHashSet` if available in this module) and dedupe via `Arc::as_ptr(&summary) as usize`:
- compute `let ptr = Arc::as_ptr(&summary) as usize;`
- `if seen_missing_summaries.insert(ptr) { result.missing_summaries.push(summary); }`

This restores O(1) membership checks while keeping the `Vec<Arc<MissingSummary>>` output structure.

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



Informational

2. Changeset missing pnpm entry 📘 Rule violation § Compliance
Description
The new changeset only declares a version bump for pacquet but does not include a pnpm entry.
This violates the changeset requirement and may prevent the pnpm release tooling from correctly
tracking/publishing this change.
Code

.changeset/amortize-hoist-round-workspace-scans.md[R1-3]

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

● Weak

Multiple recent PRs rejected adding a pnpm bump to pacquet-only changesets, despite the compliance
bot suggestion.

PR-#13575
PR-#13571
PR-#13563

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
PR Compliance ID 713436 requires that changeset front-matter explicitly includes the pnpm package
with a valid bump type. The added changeset front-matter includes only pacquet, so pnpm is
missing.

Rule 713436: Explicitly declare pnpm package and correct bump type in changesets
.changeset/amortize-hoist-round-workspace-scans.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 changeset file does not declare a bump for the `pnpm` package.

## Issue Context
Per the compliance checklist, changesets must explicitly include `pnpm` with a valid bump type (`patch`/`minor`/`major`). This PR added a new changeset that only lists `pacquet`.

## Fix Focus Areas
- .changeset/amortize-hoist-round-workspace-scans.md[1-3]

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

Previous review results

Review updated until commit 41d3f4a ⚖️ Balanced

Results up to commit 032c6d3 ⚖️ Balanced


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


Informational
1. Changeset missing pnpm entry 📘 Rule violation § Compliance
Description
The new changeset only declares a version bump for pacquet but does not include a pnpm entry.
This violates the changeset requirement and may prevent the pnpm release tooling from correctly
tracking/publishing this change.
Code

.changeset/amortize-hoist-round-workspace-scans.md[R1-3]

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

● Weak

Multiple recent PRs rejected adding a pnpm bump to pacquet-only changesets, despite the compliance
bot suggestion.

PR-#13575
PR-#13571
PR-#13563

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
PR Compliance ID 713436 requires that changeset front-matter explicitly includes the pnpm package
with a valid bump type. The added changeset front-matter includes only pacquet, so pnpm is
missing.

Rule 713436: Explicitly declare pnpm package and correct bump type in changesets
.changeset/amortize-hoist-round-workspace-scans.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 changeset file does not declare a bump for the `pnpm` package.

## Issue Context
Per the compliance checklist, changesets must explicitly include `pnpm` with a valid bump type (`patch`/`minor`/`major`). This PR added a new changeset that only lists `pacquet`.

## Fix Focus Areas
- .changeset/amortize-hoist-round-workspace-scans.md[1-3]

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


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.7±0.05ms    32.0 MB/sec    1.00     11.4±0.01ms    32.7 MB/sec
packument/parse                                  1.10     39.7±0.13µs  1669.0 MB/sec    1.00     36.0±0.33µs  1842.1 MB/sec
tarball/download_dependency                      1.00      2.3±0.06ms  1926.9 KB/sec    1.00      2.2±0.08ms  1934.2 KB/sec
tarball_batch/cold_store_many_medium_tarballs    1.00    170.0±2.25ms 94.1 KElem/sec    1.01    171.4±2.81ms 93.4 KElem/sec
workspace_resolution/hoist_heavy                 2.70    661.9±8.70ms        ? ?/sec    1.00    244.7±0.62ms        ? ?/sec

@zkochan

zkochan commented Aug 2, 2026

Copy link
Copy Markdown
Member Author

The one flagged rule violation — "Changeset missing pnpm entry" — is expected here. AGENTS.md ("Changesets for the Rust products") requires the opposite: in changesets pnpm always means the TypeScript CLI package, so a Rust-only change targets pacquet and must omit "pnpm". This PR only touches pnpm/crates/resolving-deps-resolver.


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

@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 (be932ae) to head (41d3f4a).

Additional details and impacted files
@@            Coverage Diff             @@
##             main   pnpm/pnpm#13579      +/-   ##
==========================================
- Coverage   87.99%   87.99%   -0.01%     
==========================================
  Files         563      563              
  Lines       97561    97596      +35     
==========================================
+ Hits        85853    85877      +24     
- Misses      11708    11719      +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 added the reviewed: coderabbit CodeRabbit submitted an approving review label Aug 2, 2026
@github-actions

github-actions Bot commented Aug 2, 2026

Copy link
Copy Markdown
Contributor

Integrated-Benchmark Report (Linux)

Commit: 032c6d3945aa

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.497 ± 0.161 2.358 2.791 1.71 ± 0.16
pacquet@main 2.555 ± 0.157 2.361 2.807 1.75 ± 0.16
pnpr@HEAD 1.458 ± 0.101 1.341 1.622 1.00
pnpr@main 1.537 ± 0.144 1.378 1.796 1.05 ± 0.12
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 2.4965431648,
      "stddev": 0.16139021369699835,
      "median": 2.435066331,
      "user": 1.53237892,
      "system": 1.3166689000000003,
      "min": 2.3581421175,
      "max": 2.7911002555,
      "times": [
        2.7911002555,
        2.3768145124999998,
        2.5495614014999997,
        2.3776473234999997,
        2.5081076884999995,
        2.3693566534999997,
        2.3581421175,
        2.7645690335,
        2.4075566955,
        2.4625759664999998
      ]
    },
    {
      "command": "pacquet@main",
      "mean": 2.5547045332,
      "stddev": 0.1570805154650583,
      "median": 2.5569458435,
      "user": 1.51081772,
      "system": 1.3087678999999999,
      "min": 2.3613116885,
      "max": 2.8073625205,
      "times": [
        2.8073625205,
        2.7829215554999998,
        2.5516008665,
        2.6084344785,
        2.3838087385,
        2.4289640095,
        2.3613116885,
        2.6291076964999998,
        2.4312429575,
        2.5622908205
      ]
    },
    {
      "command": "pnpr@HEAD",
      "mean": 1.4578140936,
      "stddev": 0.10099576296681619,
      "median": 1.432282279,
      "user": 1.06436592,
      "system": 1.1432426999999998,
      "min": 1.3414031745000001,
      "max": 1.6223735705,
      "times": [
        1.3581301775,
        1.5211270295,
        1.5976781355,
        1.6223735705,
        1.3414031745000001,
        1.4133746875,
        1.4446778865,
        1.4198866715,
        1.5088046905,
        1.3506849125
      ]
    },
    {
      "command": "pnpr@main",
      "mean": 1.5373880469,
      "stddev": 0.14442125123452096,
      "median": 1.5137679130000001,
      "user": 1.0695690199999999,
      "system": 1.1607421,
      "min": 1.3780521365,
      "max": 1.7961039655000002,
      "times": [
        1.3877047565,
        1.6944624155,
        1.4166776775,
        1.3780521365,
        1.4731711035000001,
        1.5580543525,
        1.6761507925,
        1.5543647225000001,
        1.4391385465,
        1.7961039655000002
      ]
    }
  ]
}

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

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 262.7 ± 6.7 251.5 275.7 1.01 ± 0.03
pacquet@main 261.1 ± 4.0 256.4 269.6 1.00
pnpr@HEAD 275.9 ± 7.0 269.9 294.1 1.06 ± 0.03
pnpr@main 262.5 ± 6.1 251.2 269.9 1.01 ± 0.03
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.26270382715999996,
      "stddev": 0.006735412699711098,
      "median": 0.26193343585999995,
      "user": 0.22104986000000001,
      "system": 0.5403819000000001,
      "min": 0.25145042086,
      "max": 0.27565514986,
      "times": [
        0.26868588386,
        0.25816398586,
        0.26611608586,
        0.26280282586,
        0.25776205686,
        0.26573119986,
        0.26106404586,
        0.25960661686,
        0.25145042086,
        0.27565514986
      ]
    },
    {
      "command": "pacquet@main",
      "mean": 0.26109766136,
      "stddev": 0.004013026471223654,
      "median": 0.26003672836,
      "user": 0.20410925999999993,
      "system": 0.5496287,
      "min": 0.25640836386,
      "max": 0.26959846385999997,
      "times": [
        0.25844882286,
        0.26025980886,
        0.26667346686,
        0.25981364786,
        0.26067559386,
        0.25640836386,
        0.26959846385999997,
        0.26136077586,
        0.25902202386,
        0.25871564586
      ]
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.27592200075999995,
      "stddev": 0.007005341798693177,
      "median": 0.27362727486,
      "user": 0.22758656,
      "system": 0.5407816999999999,
      "min": 0.26990897086,
      "max": 0.29414344786,
      "times": [
        0.27242581786,
        0.29414344786,
        0.27645709286,
        0.27446533586,
        0.26990897086,
        0.27170894586,
        0.27121111786,
        0.27799210886,
        0.27278921386,
        0.27811795586
      ]
    },
    {
      "command": "pnpr@main",
      "mean": 0.26246033256,
      "stddev": 0.006125257802842475,
      "median": 0.26283468086,
      "user": 0.22133066,
      "system": 0.49837680000000006,
      "min": 0.25120334486,
      "max": 0.26993072186,
      "times": [
        0.26152049686,
        0.25533379586,
        0.25971594186,
        0.25120334486,
        0.26922706486,
        0.26414886486,
        0.26793451586,
        0.25986935186,
        0.26571922686,
        0.26993072186
      ]
    }
  ]
}

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

Command Mean [s] Min [s] Max [s] Relative
pacquet@HEAD 2.598 ± 0.014 2.573 2.616 1.66 ± 0.16
pacquet@main 2.601 ± 0.028 2.562 2.637 1.66 ± 0.16
pnpr@HEAD 1.574 ± 0.133 1.427 1.766 1.00 ± 0.13
pnpr@main 1.566 ± 0.153 1.436 1.886 1.00
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 2.59781849832,
      "stddev": 0.014016331937447264,
      "median": 2.59511599212,
      "user": 1.4452640799999998,
      "system": 1.32003514,
      "min": 2.57313546712,
      "max": 2.61618023912,
      "times": [
        2.5936074761200003,
        2.61618023912,
        2.59028319512,
        2.6022214861200004,
        2.6160540401200003,
        2.57313546712,
        2.5926614121200005,
        2.61223026712,
        2.5851868921200003,
        2.59662450812
      ]
    },
    {
      "command": "pacquet@main",
      "mean": 2.6005519245200004,
      "stddev": 0.027608663020798813,
      "median": 2.6023163101200004,
      "user": 1.4798572799999998,
      "system": 1.32372304,
      "min": 2.5620919261200004,
      "max": 2.6365011511200005,
      "times": [
        2.5743298401200003,
        2.57948754012,
        2.63332299712,
        2.6271563431200002,
        2.5941128901200003,
        2.5620919261200004,
        2.57221692512,
        2.6105197301200005,
        2.6157799021200003,
        2.6365011511200005
      ]
    },
    {
      "command": "pnpr@HEAD",
      "mean": 1.5738761367200003,
      "stddev": 0.13300233305025005,
      "median": 1.5583195541200001,
      "user": 1.0400388799999998,
      "system": 1.16497054,
      "min": 1.4268857961199999,
      "max": 1.76582938312,
      "times": [
        1.43248518812,
        1.66363748012,
        1.72526242812,
        1.76582938312,
        1.6823998021200002,
        1.47815857712,
        1.46426266312,
        1.4613595181199999,
        1.6384805311200001,
        1.4268857961199999
      ]
    },
    {
      "command": "pnpr@main",
      "mean": 1.56607689382,
      "stddev": 0.15330636769649264,
      "median": 1.52861033062,
      "user": 1.06197958,
      "system": 1.14972194,
      "min": 1.43576145912,
      "max": 1.88641466812,
      "times": [
        1.45577402212,
        1.43576145912,
        1.52110906112,
        1.77733900612,
        1.53687622312,
        1.88641466812,
        1.6180151061199999,
        1.45531865012,
        1.5361116001200001,
        1.43804914212
      ]
    }
  ]
}

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

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 407.6 ± 6.7 394.6 414.7 1.35 ± 0.04
pacquet@main 390.7 ± 13.1 376.3 417.0 1.30 ± 0.05
pnpr@HEAD 301.4 ± 6.2 293.7 312.2 1.00
pnpr@main 307.1 ± 5.2 300.4 317.6 1.02 ± 0.03
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.40762030958000006,
      "stddev": 0.006678866024985746,
      "median": 0.41068535948000007,
      "user": 0.5483776799999999,
      "system": 0.6916440399999999,
      "min": 0.39464865248000003,
      "max": 0.41465390148000003,
      "times": [
        0.41115282748000004,
        0.40990940048,
        0.41031073848000005,
        0.41105998048000003,
        0.40151982448000006,
        0.41263660548000003,
        0.41465390148000003,
        0.41117275348000004,
        0.39464865248000003,
        0.39913841148000007
      ]
    },
    {
      "command": "pacquet@main",
      "mean": 0.39065975758000004,
      "stddev": 0.01310322943670313,
      "median": 0.38902471798000005,
      "user": 0.5338983799999999,
      "system": 0.66446494,
      "min": 0.37627931048,
      "max": 0.41702694748,
      "times": [
        0.40244012048000005,
        0.39330634048,
        0.37690270548000004,
        0.38069089248000004,
        0.37627931048,
        0.39909547048000005,
        0.41702694748,
        0.39473039648,
        0.38474309548,
        0.38138229648000005
      ]
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.30137409628000006,
      "stddev": 0.006165381463247491,
      "median": 0.29982699748,
      "user": 0.19220107999999997,
      "system": 0.5244061399999999,
      "min": 0.29369542048,
      "max": 0.31223665848000004,
      "times": [
        0.30786119448000004,
        0.31223665848000004,
        0.29702583348000006,
        0.30032378448,
        0.29543422148000004,
        0.29369542048,
        0.30188907848,
        0.30836782848000005,
        0.29933021048,
        0.29757673248000005
      ]
    },
    {
      "command": "pnpr@main",
      "mean": 0.30705901318,
      "stddev": 0.005237413034836292,
      "median": 0.30642478398000006,
      "user": 0.21725877999999996,
      "system": 0.52344624,
      "min": 0.30039037048000006,
      "max": 0.31760988448000005,
      "times": [
        0.31183109248,
        0.30039037048000006,
        0.30275597248,
        0.30561227148000003,
        0.30264232848000006,
        0.30723729648000003,
        0.30321654148000005,
        0.31760988448000005,
        0.30965222148000004,
        0.30964215248000004
      ]
    }
  ]
}

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

Command Mean [s] Min [s] Max [s] Relative
pacquet@HEAD 1.740 ± 0.009 1.725 1.750 5.82 ± 0.19
pacquet@main 1.736 ± 0.006 1.725 1.750 5.80 ± 0.19
pnpr@HEAD 0.299 ± 0.010 0.286 0.312 1.00
pnpr@main 0.306 ± 0.007 0.297 0.316 1.02 ± 0.04
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 1.7395687649000002,
      "stddev": 0.008618574247880198,
      "median": 1.7438615645000002,
      "user": 0.7295145,
      "system": 0.7703501600000001,
      "min": 1.7252075910000002,
      "max": 1.749736423,
      "times": [
        1.7444893440000002,
        1.7331913110000001,
        1.7432337850000001,
        1.747719037,
        1.749736423,
        1.73217283,
        1.729689075,
        1.7453673100000002,
        1.744880943,
        1.7252075910000002
      ]
    },
    {
      "command": "pacquet@main",
      "mean": 1.7361345775,
      "stddev": 0.006412377580220394,
      "median": 1.735542437,
      "user": 0.6995955999999999,
      "system": 0.79375416,
      "min": 1.7251948870000002,
      "max": 1.750202432,
      "times": [
        1.7343041000000001,
        1.750202432,
        1.7251948870000002,
        1.734130102,
        1.7313742530000003,
        1.737886729,
        1.740397004,
        1.7367713940000002,
        1.7357786020000001,
        1.735306272
      ]
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.2990953027,
      "stddev": 0.009632996836848672,
      "median": 0.299652691,
      "user": 0.18978840000000002,
      "system": 0.52457956,
      "min": 0.285655802,
      "max": 0.31197608400000004,
      "times": [
        0.309231545,
        0.309301107,
        0.304624165,
        0.301468401,
        0.31197608400000004,
        0.290120484,
        0.292724618,
        0.285655802,
        0.28801384,
        0.297836981
      ]
    },
    {
      "command": "pnpr@main",
      "mean": 0.3058006993,
      "stddev": 0.006519588511064273,
      "median": 0.3048363645,
      "user": 0.2123881,
      "system": 0.51042966,
      "min": 0.297112104,
      "max": 0.316292316,
      "times": [
        0.303182355,
        0.316292316,
        0.301898844,
        0.30409723,
        0.298076874,
        0.297112104,
        0.30668564400000004,
        0.315751437,
        0.30933469,
        0.30557549900000003
      ]
    }
  ]
}

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

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 181.4 ± 3.2 175.2 184.7 2.08 ± 0.05
pacquet@main 181.3 ± 5.1 175.9 197.9 2.08 ± 0.07
pnpr@HEAD 87.2 ± 1.4 84.3 91.0 1.00
pnpr@main 87.9 ± 1.9 84.3 92.9 1.01 ± 0.03
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.1813871814,
      "stddev": 0.0031727088427296398,
      "median": 0.18235317780000002,
      "user": 0.1621076,
      "system": 0.07716448666666667,
      "min": 0.17516933680000002,
      "max": 0.18466375580000002,
      "times": [
        0.18362378480000002,
        0.1799196998,
        0.18466375580000002,
        0.1822885858,
        0.1755600138,
        0.18411018080000002,
        0.1841554078,
        0.18349802680000002,
        0.1819862848,
        0.17516933680000002,
        0.1840849638,
        0.1826920368,
        0.1791767958,
        0.1775256698,
        0.18235317780000002
      ]
    },
    {
      "command": "pacquet@main",
      "mean": 0.18131860955,
      "stddev": 0.005114701065986759,
      "median": 0.1807077633,
      "user": 0.1641177375,
      "system": 0.069769045,
      "min": 0.17588131880000002,
      "max": 0.19794848480000002,
      "times": [
        0.1762568878,
        0.19794848480000002,
        0.18311397280000002,
        0.1811801748,
        0.18207242880000002,
        0.18559321880000001,
        0.18170472380000002,
        0.1801475468,
        0.17588131880000002,
        0.17994224080000001,
        0.17723731680000002,
        0.1773109968,
        0.1800883338,
        0.18120458080000001,
        0.1810043728,
        0.1804111538
      ]
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.08719655474117648,
      "stddev": 0.0014124059139702207,
      "median": 0.08709209980000002,
      "user": 0.02030571176470588,
      "system": 0.009986924705882349,
      "min": 0.0842903398,
      "max": 0.0910451708,
      "times": [
        0.0842903398,
        0.0887436308,
        0.08780043080000001,
        0.0867193208,
        0.0879643798,
        0.0875799148,
        0.08586960880000001,
        0.0883102728,
        0.0866514438,
        0.08823910780000001,
        0.0860386778,
        0.08669939380000001,
        0.08671972280000001,
        0.0866658498,
        0.0866138728,
        0.0878642018,
        0.0879369888,
        0.08701335580000001,
        0.0861888008,
        0.08682863780000001,
        0.0872300248,
        0.08828379180000001,
        0.08717084380000001,
        0.08629333880000001,
        0.0876160738,
        0.0910451708,
        0.08653112680000001,
        0.0875928898,
        0.08510610880000001,
        0.08950725080000001,
        0.08441015580000001,
        0.0899293468,
        0.08576111380000001,
        0.08746767280000001
      ]
    },
    {
      "command": "pnpr@main",
      "mean": 0.08788658404242422,
      "stddev": 0.0019081054478482726,
      "median": 0.0874667818,
      "user": 0.020624315151515155,
      "system": 0.00910572,
      "min": 0.0842574878,
      "max": 0.09286218880000001,
      "times": [
        0.0865750898,
        0.0909825018,
        0.08971785780000001,
        0.0888869708,
        0.09286218880000001,
        0.0906499568,
        0.0851087028,
        0.0871044678,
        0.08743178580000001,
        0.0870548148,
        0.0887772938,
        0.0866320768,
        0.0874667818,
        0.0878763748,
        0.08915555780000001,
        0.0857030238,
        0.0871665758,
        0.0865334818,
        0.0872159888,
        0.0907004708,
        0.0889350108,
        0.0884130058,
        0.0858301238,
        0.0869567098,
        0.08804275780000001,
        0.0867171478,
        0.0876202098,
        0.08748823280000001,
        0.0893481108,
        0.0871070828,
        0.0842574878,
        0.09075993380000001,
        0.0851794968
      ]
    }
  ]
}

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

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 985.9 ± 156.0 845.4 1299.4 1.07 ± 0.33
pacquet@main 924.0 ± 241.1 565.0 1226.3 1.00
pnpm@HEAD 3008.0 ± 95.4 2868.9 3147.7 3.26 ± 0.86
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.9858679976577778,
      "stddev": 0.15600505276073715,
      "median": 0.93405852188,
      "user": 0.9214268599999998,
      "system": 0.1943255044444444,
      "min": 0.84540292888,
      "max": 1.29941742588,
      "times": [
        0.93405852188,
        0.92545155688,
        1.15275202688,
        0.84540292888,
        1.29941742588,
        0.97771570288,
        0.84636611588,
        1.04516664688,
        0.84648105288
      ]
    },
    {
      "command": "pacquet@main",
      "mean": 0.9240295148800001,
      "stddev": 0.24111857203010817,
      "median": 0.93571051788,
      "user": 0.8459397488888887,
      "system": 0.18948972666666666,
      "min": 0.56495322188,
      "max": 1.22632487888,
      "times": [
        0.67082877688,
        0.8451055468800001,
        1.22632487888,
        0.56495322188,
        1.1660851778799999,
        0.73503966988,
        1.20329131988,
        0.96892652388,
        0.93571051788
      ]
    },
    {
      "command": "pnpm@HEAD",
      "mean": 3.007976297324445,
      "stddev": 0.09541791008869047,
      "median": 2.98464048288,
      "user": 4.60802086,
      "system": 0.2683477266666666,
      "min": 2.8689351758800004,
      "max": 3.14765938788,
      "times": [
        3.03172852588,
        2.8689351758800004,
        3.06261416688,
        2.9106582488800004,
        2.98464048288,
        3.13635032688,
        2.97422116888,
        2.95497919188,
        3.14765938788
      ]
    }
  ]
}

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

Command Mean [s] Min [s] Max [s] Relative
pacquet@HEAD 4.586 ± 0.166 4.424 4.903 1.30 ± 0.05
pacquet@main 4.455 ± 0.024 4.432 4.513 1.27 ± 0.02
pnpr@HEAD 3.521 ± 0.057 3.452 3.620 1.00
pnpr@main 3.569 ± 0.135 3.438 3.810 1.01 ± 0.04
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 4.58631400522,
      "stddev": 0.16605783795997442,
      "median": 4.55038699302,
      "user": 1.7084091000000001,
      "system": 1.3841574400000003,
      "min": 4.42385068452,
      "max": 4.90250489052,
      "times": [
        4.47397493552,
        4.90250489052,
        4.58543018552,
        4.51888036152,
        4.58189362452,
        4.42385068452,
        4.45235730752,
        4.65470636852,
        4.43817466652,
        4.83136702752
      ]
    },
    {
      "command": "pacquet@main",
      "mean": 4.45475845362,
      "stddev": 0.024146109694428455,
      "median": 4.45233910752,
      "user": 1.7316554,
      "system": 1.3642912400000002,
      "min": 4.43173469952,
      "max": 4.51283970552,
      "times": [
        4.45202456952,
        4.47508658752,
        4.43850107152,
        4.43416495252,
        4.43963015152,
        4.45590068052,
        4.45265364552,
        4.43173469952,
        4.51283970552,
        4.45504847252
      ]
    },
    {
      "command": "pnpr@HEAD",
      "mean": 3.520882378219999,
      "stddev": 0.05657632027874141,
      "median": 3.50998104302,
      "user": 1.1784403,
      "system": 1.2333790400000002,
      "min": 3.45215696252,
      "max": 3.61976057952,
      "times": [
        3.52799300152,
        3.57819853652,
        3.61976057952,
        3.48454548152,
        3.48657633252,
        3.52683951652,
        3.45215696252,
        3.58172860452,
        3.45790219752,
        3.49312256952
      ]
    },
    {
      "command": "pnpr@main",
      "mean": 3.56887865052,
      "stddev": 0.13522080132369768,
      "median": 3.52399013252,
      "user": 1.1940293,
      "system": 1.24269914,
      "min": 3.43841197752,
      "max": 3.81014452752,
      "times": [
        3.43841197752,
        3.54176579452,
        3.54265163452,
        3.81014452752,
        3.46753384552,
        3.47374841652,
        3.49418589352,
        3.60486177052,
        3.80926817452,
        3.50621447052
      ]
    }
  ]
}

@github-actions

github-actions Bot commented Aug 2, 2026

Copy link
Copy Markdown
Contributor

🐰 Bencher Report

Projectpnpm's project
Branchpr/13579
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,573.14 ms
(-1.99%)Baseline: 2,625.36 ms
3,150.43 ms
(81.68%)
isolated-linker.fresh-install.cold-cache.hot-store📈 view plot
🚷 view threshold
1,725.21 ms
(-2.13%)Baseline: 1,762.76 ms
2,115.31 ms
(81.56%)
isolated-linker.fresh-install.hot-cache.hot-store📈 view plot
🚷 view threshold
394.65 ms
(-6.37%)Baseline: 421.51 ms
505.82 ms
(78.02%)
isolated-linker.fresh-resolve.hot-cache.offline📈 view plot
🚷 view threshold
175.17 ms
(-11.14%)Baseline: 197.14 ms
236.57 ms
(74.05%)
isolated-linker.fresh-restore.cold-cache.cold-store📈 view plot
🚷 view threshold
2,358.14 ms
(-1.53%)Baseline: 2,394.80 ms
2,873.76 ms
(82.06%)
isolated-linker.fresh-restore.cold-cache.cold-store.cold-pnpr📈 view plot
🚷 view threshold
4,423.85 ms
(-1.21%)Baseline: 4,477.93 ms
5,373.51 ms
(82.33%)
isolated-linker.fresh-restore.hot-cache.hot-store📈 view plot
🚷 view threshold
251.45 ms
(-3.85%)Baseline: 261.51 ms
313.81 ms
(80.13%)
isolated-linker.peer-heavy-resolve.hot-cache.offline📈 view plot
🚷 view threshold
845.40 ms
(-22.54%)Baseline: 1,091.44 ms
1,309.73 ms
(64.55%)
🐰 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/13579
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,426.89 ms
isolated-linker.fresh-install.cold-cache.hot-store📈 view plot
⚠️ NO THRESHOLD
285.66 ms
isolated-linker.fresh-install.hot-cache.hot-store📈 view plot
⚠️ NO THRESHOLD
293.70 ms
isolated-linker.fresh-resolve.hot-cache.offline📈 view plot
⚠️ NO THRESHOLD
84.29 ms
isolated-linker.fresh-restore.cold-cache.cold-store📈 view plot
⚠️ NO THRESHOLD
1,341.40 ms
isolated-linker.fresh-restore.cold-cache.cold-store.cold-pnpr📈 view plot
⚠️ NO THRESHOLD
3,452.16 ms
isolated-linker.fresh-restore.hot-cache.hot-store📈 view plot
⚠️ NO THRESHOLD
269.91 ms
🐰 View full continuous benchmarking report in Bencher

zkochan added 3 commits August 2, 2026 13:20
…-scope maps

Every hoist round of every importer takes a whole-map snapshot of
`first_importer_by_pkg` and `first_walk_missing_by_pkg` to build its
`HoistMissingScope`, so the cost of a round was linear in workspace
size and the cost of a wave quadratic. On the hoist-heavy resolution
benchmark (331 importers, 5,030 packages) that was 1.5s of a 6.7s
resolve, spent cloning two maps 331 times over and freeing them again.

Pair each map with the `Arc` snapshot last projected from it and hand
that out until a write invalidates it. Writers reach the map through
`map_mut`, which drops the snapshot; the two writers that usually find
nothing to change — an ownership claim re-recording the importer that
already owns the package, and a later round re-recording a
missing-peer report the same owner generation already wrote — now test
first and keep to the shared reader, so a round that changes nothing
reuses the projection instead of rebuilding it.

The snapshots hold the same contents as before, and already-issued
`Arc`s keep theirs when a write invalidates the cache, so the emitted
graph is unchanged. Hoist-heavy resolution drops from ~6.7s to ~4.4s;
peak memory falls too, since one shared copy replaces the per-importer
ones.
…ithout flattening them

Each discovery pass folded its subtree summaries into an owned
`pkg id -> missing peer names` map, cloning every descendant's package
id and name set into it, and its one consumer — the per-package
owner-context record — read that map and dropped it. Both halves cost
the whole workspace per importer per hoist round: on the hoist-heavy
resolution benchmark (331 importers, 5,030 packages) the discovery
passes built 1.6M entries and spent 1.1s freeing them again.

The summaries are already shared bottom-up by `Arc`, so the pass can
report its roots instead and let the reader index them. The index
borrows the names in place, which makes it free to drop, and the union
a package's several occurrences require is only materialized when a
second summary reports the same package.

Hoist-heavy resolution drops from ~4.4s to ~1.5s, and peak memory with
it: the flattened copies are never built.
…ot and missing-peer index

Both amortizations rest on a contract a passing resolve does not
demonstrate on its own: that a shared snapshot is invalidated by every
write that changes its map and reused by every write that does not, and
that indexing a walk's summaries in place still visits every descendant
and unions what several occurrences of one package reported.

Each test fails against the corresponding break: dropping the
invalidation in `map_mut`, dropping the descent into a summary's
children, and letting the last occurrence of a package overwrite the
earlier ones instead of unioning with them.

Also settle the lints the new code tripped: an elidable lifetime on the
index, the type complexity of the snapshot cell, which gets a name, and
the snapshot cell's single-letter type parameters.
@zkochan
zkochan force-pushed the perf-parallel-peer-phase branch from 032c6d3 to 41d3f4a Compare August 2, 2026 11:23
Copilot AI review requested due to automatic review settings August 2, 2026 11:23

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.

@qodo-code-review

Copy link
Copy Markdown

Code review by qodo was updated up to the latest commit 41d3f4a

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

@zkochan

zkochan commented Aug 2, 2026

Copy link
Copy Markdown
Member Author

On "Quadratic summary dedupe": I tested the alternative rather than reasoning about it, and it is slower.

Swapping the linear Arc::ptr_eq scan for a pointer HashSet — the O(k) dedupe the finding implies — on the CI-sized hoist-heavy group:

workspace_resolution/hoist_heavy
                        time:   [229.82 ms 231.80 ms 233.96 ms]
                        change: [+7.4239% +9.9362% +12.264%] (p = 0.00 < 0.05)
                        Performance has regressed.

9.9% slower. k here is one importer's direct-dep count (roots plus hoisted providers), so the scan is over tens of pointers; comparing them is cheaper than hashing them, and the set allocation per pass is pure overhead. ChildOutputs::push already dedupes child summaries the same way, at a larger k, so this also keeps the two consistent.

Keeping the linear scan.

On "Changeset missing": .changeset/amortize-hoist-round-workspace-scans.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.

For the record, the CI micro-benchmark now measures this PR directly, via the gate added in #13581:

workspace_resolution/hoist_heavy    main 2.70  661.9±8.70ms    pr 1.00  244.7±0.62ms

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

@zkochan
zkochan merged commit c2b2f15 into main Aug 2, 2026
32 checks passed
@zkochan
zkochan deleted the perf-parallel-peer-phase branch August 2, 2026 11:32
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