Repository navigation
test(micro-benchmark): gate multi-importer workspace resolution in CI - #13581
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Plus Run ID: ⛔ Files ignored due to path filters (1)
📒 Files selected for processing (4)
💤 Files with no reviewable changes (1)
🚧 Files skipped from review as they are similar to previous changes (3)
📝 WalkthroughWalkthroughThe PR moves the full workspace-resolution benchmark to the micro-benchmark crate. It adds size-aware fixtures, CI Criterion execution, and a one-shot full-workspace CLI mode. The resolver crate benchmark declaration is removed. ChangesWorkspace resolution benchmark
Estimated code review effort: 3 (Moderate) | ~20 minutes Sequence Diagram(s)sequenceDiagram
participant CLI
participant Workspace
participant GraphResolver
CLI->>Workspace: construct selected workspace shape
Workspace->>GraphResolver: resolve workspace graph
GraphResolver-->>Workspace: return graph-node count
Workspace-->>CLI: report timing and workspace counts
Possibly related issues
Possibly related PRs
Suggested labels: Suggested reviewers: ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
PR Summary by QodoGate hoist-heavy workspace resolution micro-benchmark in CI
AI Description
Diagram
High-Level Assessment
Files changed (5)
|
Code Review by Qodo
Context used✅ Compliance rules (platform):
24 rules 1.
|
PR Code Suggestions ✨Warning
No code suggestions found for the PR. |
Confidence Score: 5/5The PR appears safe to merge. No blocking failure remains. Reviews (2): Last reviewed commit: "test(micro-benchmark): gate multi-import..." | Re-trigger Greptile |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 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/tasks/micro-benchmark/src/main.rs`:
- Around line 225-228: Update main() around the CliArgs destructuring and
full_workspace_resolution branch to reject combinations where save_baseline and
full_workspace_resolution are both enabled. Return an appropriate error before
calling workspace_resolution::run_full_workspace_resolution(), while preserving
the existing standalone behavior of each flag.
🪄 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: 952524d2-b182-4792-96cf-a67438120d95
⛔ Files ignored due to path filters (1)
Cargo.lockis excluded by!**/*.lock,!Cargo.lock
📒 Files selected for processing (4)
pnpm/crates/resolving-deps-resolver/Cargo.tomlpnpm/tasks/micro-benchmark/Cargo.tomlpnpm/tasks/micro-benchmark/src/main.rspnpm/tasks/micro-benchmark/src/workspace_resolution.rs
💤 Files with no reviewable changes (1)
- pnpm/crates/resolving-deps-resolver/Cargo.toml
The hoist-heavy resolution fixture is the only benchmark that measures the peer-hoist loop — the importer barrier, the per-round context syncs, and the per-importer work that scales with the workspace. Nothing ran it in CI: it lived as a harness-free bench in the resolver crate, and the scenarios the integrated benchmark does run converge in one hoist round, so none of them moves when that loop's cost changes. An A/B of the 40-importer integrated-benchmark fixture measures 820.6ms against 819.0ms across a change that makes the loop 4.4x faster. Move the fixture into the micro-benchmark task, which already builds both sides of a pull request and posts their comparison, and give it two sizes. The CI size — 120 importers over 1,200 packages — runs under criterion on every PR at ~0.2s a resolve; the full size, which models the 331-importer workspace the original regression came from, keeps its single timed run behind `--full-workspace-resolution`, since a regressed run there can take minutes and several GiB and has no business in a statistical harness. Only the hoist-heavy shape is benched. The plain and peer-heavy shapes re-measure the tree walk that other scenarios already cover, and with every peer provided up front their hoist loop converges in one round. The CI size keeps the signal: across the same change, the group moves 577ms -> 219ms (-62%, p = 0.00). Related to https://github.com/pnpm/pnpm/issues/13505.
5a4ca10 to
6b7a291
Compare
|
Both findings were right and are fixed in 6b7a291:
Written by an agent (Claude Code, claude-opus-5). |
|
Code review by qodo was updated up to the latest commit 6b7a291 |
PR Code Suggestions ✨Warning
No code suggestions found for the PR. |
Micro-Benchmark ResultsLinux |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main pnpm/pnpm#13581 +/- ##
==========================================
- Coverage 87.99% 87.98% -0.02%
==========================================
Files 563 563
Lines 97561 97561
==========================================
- Hits 85850 85840 -10
- Misses 11711 11721 +10 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Summary
No CI benchmark measures the peer-hoist loop, so a change to its cost —
in either direction — passes unnoticed. This puts the fixture that does
measure it in front of the harness that already compares both sides of a
pull request.
The gap, measured rather than assumed:
the loop. It lived as a harness-free bench in the resolver crate that
nothing in CI invoked.
round, so none of them moves when the loop's cost changes. I also
prototyped a 40-importer hoist-heavy scenario for it, and A/B'd it
across perf(resolving-deps-resolver): amortize the per-importer workspace scans in the hoist loop #13579, which makes the loop 4.4x faster: 820.6 ms vs
819.0 ms (1.00 ± 0.29). At that scale the per-importer work is ~16k
map entries a round and is buried in an 820 ms end-to-end install that
is mostly linking. I am not proposing that scenario.
mainand the PR head, runsboth under criterion, and posts their comparison. It is deterministic,
in-process, and needs no registry — the right instrument for a
resolver-internal cost.
The change
Move the fixture into the micro-benchmark task and give it two sizes.
Size::Ci— 120 importers over 1,200 packages — runs under criterionon every PR at ~0.2s a resolve. Both factors of the per-importer work
shrink together, so the shape of what it measures is unchanged.
Size::Full— the 331-importer, 5,000-package workspace the originalregression came from — keeps its single timed run, now behind
--full-workspace-resolution. A regressed run at that size can takeminutes and several GiB, which has no business in a statistical harness;
that is why the bench had no harness to begin with.
Only the hoist-heavy shape is benched. The plain and peer-heavy shapes
re-measure the tree walk other scenarios already cover, and with every
peer provided up front their hoist loop converges in one round.
Moving rather than copying keeps one home for the fixture: the bench
could not import from a task crate, and duplicating ~300 lines of
fixture across the two would leave them free to drift.
That it discriminates
Across #13579, on the CI size:
577 ms → 219 ms. A future change that reintroduces either quadratic
shows up as a ~2.6x regression in the table on its own PR.
The group costs ~9s of the job (3s warmup, 10 samples).
Squash Commit Body
Checklist
already linked to it solves it.
pnpm/port, or the description notes what still needs porting.pnpm changeset) if this PR changes any publishedpackage.
Written by an agent (Claude Code, claude-opus-5).
Need help on this PR? Tag
@codesmith-botwith what you need. Autofix is disabled.Summary by CodeRabbit