Skip to content

perf(npm-lock-graph): pre-freeze node objects at construction time; remove redundant uniquePathArrays#654

Merged
sonukapoor merged 1 commit into
mainfrom
perf/issue-645-prefreeze-nodes
Jun 14, 2026
Merged

perf(npm-lock-graph): pre-freeze node objects at construction time; remove redundant uniquePathArrays#654
sonukapoor merged 1 commit into
mainfrom
perf/issue-645-prefreeze-nodes

Conversation

@sonukapoor

Copy link
Copy Markdown
Collaborator

Two improvements to createGraph in the npm lock graph parser:

Fix 3: Pre-compute frozen node objects and arrays at construction time. getNode(), nodeIdsFor(), parentsFor(), childrenFor() now return pre-frozen values from Maps instead of calling Object.freeze({ ...node }) on every access.

Fix 4: Remove redundant uniquePathArrays() from pathsFor() — the Set<string> source already guarantees uniqueness.

Refs #645

…ion time; remove redundant uniquePathArrays

Refs #645
@sonukapoor sonukapoor force-pushed the perf/issue-645-prefreeze-nodes branch from efb5a87 to b95f8b2 Compare June 14, 2026 15:35
@sonukapoor sonukapoor merged commit bdf8bf6 into main Jun 14, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant