Skip to content

Fix two performance bugs in walkDependencyTree#371

Open
YieldRay wants to merge 1 commit into
honojs:mainfrom
YieldRay:perf/fix-walk-dependency-tree-memoization
Open

Fix two performance bugs in walkDependencyTree#371
YieldRay wants to merge 1 commit into
honojs:mainfrom
YieldRay:perf/fix-walk-dependency-tree-memoization

Conversation

@YieldRay

Copy link
Copy Markdown

Bug 1 — No subtree memoization (O(N²) walk)

The existing cache object only avoids re-reading files from disk. It does not prevent re-walking a subtree. When 70 app files all transitively import utils.ts, the subtree rooted at utils.ts was walked 70 times instead of once.

Bug 2 — Recurses into node_modules

precinct extracts every import string from a file, including third-party ones ('react', 'clsx', '@base-ui/react'). The walk was resolving and recursing into all of them. An island component that uses React + one UI library can pull in hundreds of node_modules files, none of which can ever contain an island component.

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