You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Hoisted linker blows up on dense peer-variant graphs since peer variants keep distinct hoister references #323
The isolated linker on the same lockfile finishes in about 57s, so this is specific to hoisting.
Measurements
Running real-hoist directly on the lockfile filtered to the 2,310 benchmarked importers (M1 Max, instrumented build):
34M+ decouple_child copies before I stopped it, with tree depth around 30.
About 33M of the absorb decisions are Conflict between two peer variants of the same name@version, for example two snapshots of one @atlaskit/* version that differ only in which react / @types/react line satisfies their peers.
The repo has 1,518 such peer-variant snapshots (8,395 snapshots for 6,877 distinct name@version).
Cause
pnpm/pnpm#17397 (fix(hoist): preserve peer variants in workspaces) makes a peer-bearing node keep its own snapshot key as its hoister reference. The TypeScript v11 getHoisterPkgId collapses every registry variant to name@version. With distinct references, two variants can never share a hoisted position, so each conflict decouples a subtree copy. On a dense peer graph the copies multiply at every level.
What a fix needs
A rule for when two peer variants are interchangeable at a given position: both resolve every peer to the same physical package from that position. The hoister would then treat them as one reference there and keep them distinct only where their peers really differ. That keeps the correctness fix of pnpm/pnpm#17397 without the blow-up.
Repro
Clone the repo above and run ./bench.sh once to populate the caches.
Set nodeLinker: hoisted and run pnpm install --frozen-lockfile --offline with an empty node_modules.
Watch RSS grow without the install reaching the link phase.
Related: the isolated-linker part of the same report is answered by enableGlobalVirtualStore (warm install 11-13s vs Yarn ~50s on this machine).
Written by an agent (Claude Code, claude-opus-5-5).
For the isolated-linker side of the same report: pnpm/pnpm#18294 keys the macOS dir-clone cache by package content, so peer variants share one cached copy. The reporter measured -14% to -19% on this repro. It does not change the hoisted problem described here.
Written by an agent (Claude Code, claude-opus-5-5).
Draft fix: pnpm/pnpm#18303. Root cause: the Rust hoister never ported upstream's peer ordering (getSortedRegularDependencies, Hoistable.DEPENDS), and its own peer check refused dedups and re-walked refused copies per path. The PR ports upstream's algorithm and adds a post-hoist repair for pnpm peer shapes outside Yarn's model (alias-bound and transitive peers). The synthesized monorepo now hoists in 2.9 s at 524 MB, against 25+ GB and no result before.
Written by an agent (Claude Code, claude-opus-5-5).
The hoister now shares one identity across compatible peer variants without cross-linking them, ports upstream peer ordering, and repairs remaining peer bindings after hoisting. The synthesized monorepo now hoists in seconds at hundreds of megabytes, and the PR is green on main. The remaining notes in its description are follow-ups, not blockers for this issue.
Activity
zkochan commentedon Nov 21, 2026
For the isolated-linker side of the same report: pnpm/pnpm#18294 keys the macOS dir-clone cache by package content, so peer variants share one cached copy. The reporter measured -14% to -19% on this repro. It does not change the hoisted problem described here.
Written by an agent (Claude Code, claude-opus-5-5).
zkochan commentedon Nov 21, 2026
Draft fix: pnpm/pnpm#18303. Root cause: the Rust hoister never ported upstream's peer ordering (getSortedRegularDependencies, Hoistable.DEPENDS), and its own peer check refused dedups and re-walked refused copies per path. The PR ports upstream's algorithm and adds a post-hoist repair for pnpm peer shapes outside Yarn's model (alias-bound and transitive peers). The synthesized monorepo now hoists in 2.9 s at 524 MB, against 25+ GB and no result before.
Written by an agent (Claude Code, claude-opus-5-5).
kairosci commentedon Nov 26, 2026
Resolved by pnpm/pnpm#18303, merged as 691d13b136.
The hoister now shares one identity across compatible peer variants without cross-linking them, ports upstream peer ordering, and repairs remaining peer bindings after hoisting. The synthesized monorepo now hoists in seconds at hundreds of megabytes, and the PR is green on main. The remaining notes in its description are follow-ups, not blockers for this issue.
Written by an agent (Big Pickle, big-pickle).