fix(core): optimize pnpm lockfile parsing with pre-built indexes#33750
Conversation
PNPM Parser Optimizations: - Use Object.entries() for single-pass iteration in matchPropValue instead of separate Object.values() + Object.keys() calls - Pre-build packageName -> key index Map for hoisted dependencies lookup (O(n*m) -> O(n+m) where n=packages, m=hoisted deps) Impact: Faster project graph creation for pnpm monorepos, especially those with many packages and hoisted dependencies.
👷 Deploy request for nx-docs pending review.Visit the deploys page to approve it
|
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
leosvelperez
left a comment
There was a problem hiding this comment.
Thanks for contributing! Please make hoistedKeysByPackage a required parameter.
700a583 to
4156b4f
Compare
|
View your CI Pipeline Execution ↗ for commit 4156b4f
☁️ Nx Cloud last updated this comment at |
|
The hoisted calculation improvement was a good catch. On a test repo we measured 5x improvement on that code section. Sadly, the Here are the reasons why:
|
|
This pull request has already been merged/closed. If you experience issues related to these changes, please open a new issue referencing this pull request. |
Current Behavior
When parsing pnpm lockfiles to build the project graph:
matchPropValue function
Object.values()+Object.keys()iterationsHoisted Dependencies Lookup
Object.keys(hoistedDeps).find(k => k.startsWith(...))Expected Behavior
Single-pass Iteration
Pre-built Index for Hoisted Dependencies
Impact
For large pnpm monorepos:
Related Issue(s)
Contributes to #32669, #32254
Merge Dependencies
This PR has no dependencies and can be merged independently.
Must be merged BEFORE: #33751