Repository navigation
perf(install): parallel importer manifest transforms and one-pass link rendering - #14523
Conversation
…k rendering Two costs the warm lockfile-only update profile on the 6,833-project workspace repro still charged per importer: - build_manifest_transforms cloned and transformed every importer manifest serially; the compatibility-DB extender is active by default, so a workspace-scale install always paid the whole loop on the main thread. Each importer's transform is independent, so the loop now fans out across rayon and the rebuilt BTreeMap restores the ordering (16 -> 2 profile samples). - ImporterAnchor::target_relative_to_importer split the target string twice per edge: once to find the shared prefix, and again to render the kept tail. One pass over the target's bytes now classifies the raw segments, grows the shared prefix, and remembers where the kept tail starts; when the tail is verbatim (no collapsed separators, dot segments, or trailing separator - the overwhelmingly common case) the rendering is a single String build from the climb and the raw tail slice. A non-verbatim tail falls back to the segment join, with new unit tests pinning that both spellings render identically. Warm lockfile-only update on the repro: median 1067 ms -> 969 ms, with the produced lockfile byte-identical (only the flipped specifier changes). Part of the #14352 performance effort.
PR Summary by QodoParallelize manifest transforms and streamline link rendering
AI Description
Diagram
High-Level Assessment
Files changed (4)
|
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Team Run ID: 📒 Files selected for processing (2)
🚧 Files skipped from review as they are similar to previous changes (2)
Included review availability: Your plan provides up to 10 included reviews per hour; 7 remain after this review. 📝 WalkthroughWalkthroughThe package manager now transforms importer manifests in parallel. The dependency resolver uses single-pass relative link rendering with fast-path output and fallback normalization. Tests cover normalized targets, identical paths, and importer-prefix paths. ChangesManifest and link performance
Estimated code review effort: 3 (Moderate) | ~20 minutes Merge Risk: ⚪ Minimal · up to This change improves install performance while preserving deterministic manifest ordering and adds link-target boundary coverage. No current merge-blocking risk remains. Suggested labels: ✨ 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 |
Code Review by Qodo
1. pnpm missing from changeset
|
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: "docs: trim the changeset and the scanner..." | Re-trigger Greptile |
Micro-Benchmark ResultsLinux |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #14523 +/- ##
=======================================
Coverage 88.94% 88.94%
=======================================
Files 709 709
Lines 127160 127198 +38
=======================================
+ Hits 113097 113140 +43
+ Misses 14063 14058 -5 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
Code review by qodo was updated up to the latest commit 16668fc |
PR Code Suggestions ✨Warning
No code suggestions found for the PR. |
Integrated-Benchmark Report (Linux)Commit: Regular scenarios report direct and pnpr installs. The peer-heavy resolver scenario compares current Rust, main Rust, and TypeScript pnpm. 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
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 2.3918170416800004,
"stddev": 0.10734669056338553,
"median": 2.39613073898,
"user": 1.4448174999999999,
"system": 1.4202865399999998,
"min": 2.2492895119800003,
"max": 2.5902584029800004
},
{
"command": "pacquet@main",
"mean": 2.31072684108,
"stddev": 0.12700705960894465,
"median": 2.2495706599800003,
"user": 1.3754764000000002,
"system": 1.3325125400000002,
"min": 2.2234457249800004,
"max": 2.5964688599800003
},
{
"command": "pnpr@HEAD",
"mean": 1.40708317188,
"stddev": 0.1346440561889791,
"median": 1.3618244609799999,
"user": 1.2677441000000003,
"system": 1.2508659399999997,
"min": 1.28350982998,
"max": 1.65671205098
},
{
"command": "pnpr@main",
"mean": 1.44828007538,
"stddev": 0.12231936801386552,
"median": 1.41074143848,
"user": 1.2577890999999999,
"system": 1.2086155399999998,
"min": 1.29613968298,
"max": 1.63535463398
}
]
}Scenario: Isolated linker: fresh restore, hot cache + hot store
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 0.20240839198000002,
"stddev": 0.005337757858756327,
"median": 0.20120252148,
"user": 0.18919722,
"system": 0.46785132,
"min": 0.19525560548,
"max": 0.21015599948
},
{
"command": "pacquet@main",
"mean": 0.20445007558,
"stddev": 0.007676600769015189,
"median": 0.20611326948,
"user": 0.18846091999999998,
"system": 0.49798282,
"min": 0.19293661448,
"max": 0.21911733348
},
{
"command": "pnpr@HEAD",
"mean": 0.21294161398,
"stddev": 0.00934907063780602,
"median": 0.21127738698,
"user": 0.20875362000000003,
"system": 0.4644057200000001,
"min": 0.20168729948,
"max": 0.23462377448
},
{
"command": "pnpr@main",
"mean": 0.21757115398,
"stddev": 0.019201376476438308,
"median": 0.21286950548,
"user": 0.20483812,
"system": 0.46813371999999986,
"min": 0.20351605148000002,
"max": 0.26892428048
}
]
}Scenario: Isolated linker: repeat install, hot cache + hot store
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 0.007399815238012429,
"stddev": 0.0009589254755514765,
"median": 0.00709216712,
"user": 0.004579991925465838,
"system": 0.0033372521739130404,
"min": 0.00639707012,
"max": 0.01164732112
},
{
"command": "pacquet@main",
"mean": 0.007551612851800766,
"stddev": 0.0009348435304738461,
"median": 0.007246991120000001,
"user": 0.004418129118773942,
"system": 0.003670229885057469,
"min": 0.00635103312,
"max": 0.01152602212
},
{
"command": "pnpr@HEAD",
"mean": 0.007575080515894431,
"stddev": 0.0010624389162604071,
"median": 0.007243276119999999,
"user": 0.004464439002932548,
"system": 0.003646762463343106,
"min": 0.00643078912,
"max": 0.012462355120000001
},
{
"command": "pnpr@main",
"mean": 0.007822810150701753,
"stddev": 0.0013824082406337693,
"median": 0.00730506362,
"user": 0.0042904807017543865,
"system": 0.0040568973684210535,
"min": 0.00633947512,
"max": 0.01321064012
}
]
}Scenario: Isolated linker: repeat install, cold cache + hot store
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 0.007150424557763159,
"stddev": 0.0005712391572978026,
"median": 0.007045898640000001,
"user": 0.004372652763157894,
"system": 0.003245392105263159,
"min": 0.006454435140000001,
"max": 0.012715333140000002
},
{
"command": "pacquet@main",
"mean": 0.007364756573962269,
"stddev": 0.0009610063516410995,
"median": 0.007103915640000001,
"user": 0.004336970062893084,
"system": 0.003497796226415095,
"min": 0.006501122140000001,
"max": 0.013197614140000001
},
{
"command": "pnpr@HEAD",
"mean": 0.007486831211428569,
"stddev": 0.0009869001086483394,
"median": 0.00716589564,
"user": 0.004276294782608696,
"system": 0.0036956714285714272,
"min": 0.006511959140000001,
"max": 0.01182378014
},
{
"command": "pnpr@main",
"mean": 0.007708169201302681,
"stddev": 0.0011713083403384551,
"median": 0.007372970140000001,
"user": 0.0044738446743295005,
"system": 0.003725207662835245,
"min": 0.006429159140000001,
"max": 0.01471866714
}
]
}Scenario: Isolated linker: fresh install, cold cache + cold store
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 2.41763889386,
"stddev": 0.013000248318727009,
"median": 2.41691942316,
"user": 1.6475299800000003,
"system": 1.42587336,
"min": 2.39389688466,
"max": 2.43382843766
},
{
"command": "pacquet@main",
"mean": 2.40963125686,
"stddev": 0.005602849651355155,
"median": 2.4087439666600003,
"user": 1.7083063800000002,
"system": 1.35167706,
"min": 2.39947498566,
"max": 2.41700731166
},
{
"command": "pnpr@HEAD",
"mean": 1.4962896007600002,
"stddev": 0.12002028944887881,
"median": 1.48199955616,
"user": 1.1588081799999999,
"system": 1.17332676,
"min": 1.35885875966,
"max": 1.6703229936600001
},
{
"command": "pnpr@main",
"mean": 1.50637457956,
"stddev": 0.14380728620557845,
"median": 1.42161402966,
"user": 1.19675278,
"system": 1.2885998600000002,
"min": 1.38223816566,
"max": 1.72118395966
}
]
}Scenario: Isolated linker: fresh install, hot cache + hot store
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 0.33325087620000005,
"stddev": 0.02570774392271105,
"median": 0.32205650480000003,
"user": 0.46552592,
"system": 0.7426192799999999,
"min": 0.3054618818,
"max": 0.3724778988
},
{
"command": "pacquet@main",
"mean": 0.3167178589,
"stddev": 0.010963859110512477,
"median": 0.3192274163,
"user": 0.42145091999999995,
"system": 0.7183140800000001,
"min": 0.3000069298,
"max": 0.32985825080000003
},
{
"command": "pnpr@HEAD",
"mean": 0.2681332173,
"stddev": 0.011576240409344858,
"median": 0.2678714378,
"user": 0.18288652,
"system": 0.48698937999999997,
"min": 0.2490021578,
"max": 0.2851665168
},
{
"command": "pnpr@main",
"mean": 0.256253232,
"stddev": 0.005445645915015671,
"median": 0.2566366763,
"user": 0.17579772,
"system": 0.44541117999999996,
"min": 0.24733370580000003,
"max": 0.2622178738
}
]
}Scenario: Isolated linker: fresh install, cold cache + hot store
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 1.5183137269200002,
"stddev": 0.020714967698430307,
"median": 1.5166242353200001,
"user": 0.71607278,
"system": 0.8604969,
"min": 1.49763309882,
"max": 1.5688545368200002
},
{
"command": "pacquet@main",
"mean": 1.5225508927200002,
"stddev": 0.018926039513057206,
"median": 1.5191996838200001,
"user": 0.75485878,
"system": 0.8961832999999999,
"min": 1.48322522782,
"max": 1.5464659448200002
},
{
"command": "pnpr@HEAD",
"mean": 0.25351825622000007,
"stddev": 0.004827318937953867,
"median": 0.25219978532,
"user": 0.15669238000000002,
"system": 0.46514679999999997,
"min": 0.24767378882000002,
"max": 0.26328884682000003
},
{
"command": "pnpr@main",
"mean": 0.25643991202,
"stddev": 0.018650063965023778,
"median": 0.24912801332,
"user": 0.17628258,
"system": 0.46002849999999995,
"min": 0.24432899782,
"max": 0.30578946182
}
]
}Scenario: Isolated linker: fresh resolve, hot cache, offline
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 0.19073580559428574,
"stddev": 0.012440930864282714,
"median": 0.19065893938000003,
"user": 0.1843602028571428,
"system": 0.06807565714285714,
"min": 0.17015629338000002,
"max": 0.21103466238000002
},
{
"command": "pacquet@main",
"mean": 0.19261544864666671,
"stddev": 0.011072774402197205,
"median": 0.18940753938000002,
"user": 0.17980432666666665,
"system": 0.07126663333333333,
"min": 0.17984823638000003,
"max": 0.22292206038000004
},
{
"command": "pnpr@HEAD",
"mean": 0.09595863057354839,
"stddev": 0.003368915990107882,
"median": 0.09569096138000001,
"user": 0.032996479354838716,
"system": 0.015557267741935485,
"min": 0.09129783538,
"max": 0.10461819038
},
{
"command": "pnpr@main",
"mean": 0.09363864081333333,
"stddev": 0.0021223365314008364,
"median": 0.09265546688000001,
"user": 0.031536426666666666,
"system": 0.015279613333333334,
"min": 0.09109185738,
"max": 0.09738267338
}
]
}Scenario: Isolated linker: peer-heavy resolve, hot cache, offline
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 0.6879619100022223,
"stddev": 0.05341266054013006,
"median": 0.67479732278,
"user": 0.6709207155555554,
"system": 0.16869322222222222,
"min": 0.60017010778,
"max": 0.76607073778
},
{
"command": "pacquet@main",
"mean": 0.6995912606688891,
"stddev": 0.04466303185833367,
"median": 0.69671839578,
"user": 0.6843370488888888,
"system": 0.168733,
"min": 0.64369060178,
"max": 0.78477196678
},
{
"command": "pnpm@HEAD",
"mean": 2.935087943668889,
"stddev": 0.06000107572401545,
"median": 2.91985306878,
"user": 4.1647373822222225,
"system": 0.29264111111111113,
"min": 2.86676611878,
"max": 3.04661228878
}
]
}Scenario: Isolated linker: fresh restore, cold cache + cold store + cold pnpr
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 4.39116800466,
"stddev": 0.13676726827584149,
"median": 4.32637611776,
"user": 1.43439002,
"system": 1.3339108000000002,
"min": 4.28122323776,
"max": 4.69137358876
},
{
"command": "pacquet@main",
"mean": 4.38489577446,
"stddev": 0.09980209829996277,
"median": 4.37713813526,
"user": 1.40411272,
"system": 1.383983,
"min": 4.27436528176,
"max": 4.55639697576
},
{
"command": "pnpr@HEAD",
"mean": 3.454254507660001,
"stddev": 0.09472181239749437,
"median": 3.44652164626,
"user": 1.33396452,
"system": 1.3957165999999999,
"min": 3.35860892376,
"max": 3.67965263576
},
{
"command": "pnpr@main",
"mean": 3.42938121846,
"stddev": 0.0807772001511116,
"median": 3.40570604776,
"user": 1.32779962,
"system": 1.3843358000000001,
"min": 3.35277679976,
"max": 3.60795932976
}
]
}Scenario: GVS linker: fresh restore, hot cache + hot storeSame install as the isolated fresh-restore hot/hot scenario, into the shared virtual store — the layout pnpm 12 installs into by default. Comparable to that scenario head-to-head.
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 0.11756801764695654,
"stddev": 0.0065745824580590315,
"median": 0.11695104056,
"user": 0.15949559304347827,
"system": 0.14998451304347823,
"min": 0.10908030256000001,
"max": 0.13097848856000002
},
{
"command": "pacquet@main",
"mean": 0.12370599416000003,
"stddev": 0.0059172436725677836,
"median": 0.12355096856,
"user": 0.15714273000000004,
"system": 0.15927229999999998,
"min": 0.11429920556,
"max": 0.13810169756000001
},
{
"command": "pnpr@HEAD",
"mean": 0.14758018889333335,
"stddev": 0.010678006762915325,
"median": 0.14749959106000002,
"user": 0.18063362444444442,
"system": 0.16179826666666663,
"min": 0.13119681556,
"max": 0.17119011056000003
},
{
"command": "pnpr@main",
"mean": 0.13420445079529414,
"stddev": 0.008397288199447033,
"median": 0.13202873856000003,
"user": 0.1646586211764706,
"system": 0.14898448235294115,
"min": 0.12417087556,
"max": 0.15364556156000003
}
]
} |
|
| Project | pnpm's project |
| Branch | pr/14523 |
| Testbed | pnpr |
⚠️ 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-thresholdsflag.
Click to view all benchmark results
| Benchmark | Latency | milliseconds (ms) |
|---|---|---|
| gvs-linker.fresh-restore.hot-cache.hot-store | 📈 view plot | 131.20 ms |
| isolated-linker.fresh-install.cold-cache.cold-store | 📈 view plot | 1,358.86 ms |
| isolated-linker.fresh-install.cold-cache.hot-store | 📈 view plot | 247.67 ms |
| isolated-linker.fresh-install.hot-cache.hot-store | 📈 view plot | 249.00 ms |
| isolated-linker.fresh-resolve.hot-cache.offline | 📈 view plot | 91.30 ms |
| isolated-linker.fresh-restore.cold-cache.cold-store | 📈 view plot | 1,283.51 ms |
| isolated-linker.fresh-restore.cold-cache.cold-store.cold-pnpr | 📈 view plot | 3,358.61 ms |
| isolated-linker.fresh-restore.hot-cache.hot-store | 📈 view plot | 201.69 ms |
| isolated-linker.repeat-install.cold-cache.hot-store | 📈 view plot | 6.51 ms |
| isolated-linker.repeat-install.hot-cache.hot-store | 📈 view plot | 6.43 ms |
Summary
Related to pnpm/pnpm#14352 (continuing the large-workspace performance effort).
Re-profiling the warm lockfile-only update on the 6,833-project repro (current
main, ~1.07 s median locally) surfaced two per-importer costs still paid serially:build_manifest_transformstransformed every importer manifest on the main thread. The compatibility-DB package extender is active by default, so a workspace-scale install always clones and rewrites all 6,833 importer manifests in a serial loop before resolution starts. Each importer's transform is independent, so the loop now fans out across rayon; the rebuiltBTreeMaprestores ordering regardless of completion order. Profile: 16 → 2 samples.ImporterAnchor::target_relative_to_importersplit the target string twice per edge — once to find the shared prefix with the importer suffix, and again to render the kept tail (str::splitwas the single largest self-time entry in the profile). One pass over the target's bytes now classifies raw segments, grows the shared prefix, and remembers where the kept tail starts; when the tail is verbatim (no collapsed separators,.segments, or trailing separator — the overwhelmingly common case) the rendering is a singleStringbuild from the climb count and the raw tail slice. A non-verbatim tail falls back to the segment join. New unit tests pin that messy spellings (packages//lib,packages/./lib,packages/lib/,./packages/lib) render identically to their clean form, alongside the existingdiff_pathsparity test. Profile: peers pass 56 → 42 samples inclusive.Benchmark (protocol from the prior PRs in this effort: restore
package.json+pnpm-lock.yaml, flip one root depworkspace:*→workspace:^,pnpm install --lockfile-only --trust-lockfile --offline --ignore-scripts, medians of 10 runs):The produced lockfile is byte-identical: diffing against the committed lockfile shows exactly the one flipped specifier line.
This is pacquet-internal performance work with no user-visible behavior change, so no TypeScript-side change is needed.
Squash Commit Body
Checklist
already linked to it solves it.
pnpm/port, or the description notes what still needs porting.(pacquet-internal performance work; no behavior change to mirror.)
pnpm changeset) if this PR changes any publishedpackage. Keep it short and written for pnpm users — it becomes a release note.
Written by an agent (Claude Code, claude-fable-5).
Need help on this PR? Tag
@codesmith-botwith what you need. Autofix is disabled.Summary by CodeRabbit
Performance
Bug Fixes
Tests