Skip to content

perf(fmt): optimize discovery path resolution - #207

Merged
chenjiahan merged 1 commit into
mainfrom
chenjiahan/perf-fmt-discovery-resolver
Aug 6, 2026
Merged

perf(fmt): optimize discovery path resolution#207
chenjiahan merged 1 commit into
mainfrom
chenjiahan/perf-fmt-discovery-resolver

Conversation

@chenjiahan

Copy link
Copy Markdown
Member

Glob discovery currently calls path.relative for every candidate file, making path resolution file-linear for positive and negative globs. This PR creates a root-scoped resolver that slices paths beneath cwd and falls back to path.relative for paths outside the root.

On rsbuild, path.relative calls drop from 3,377 to 11 for **/* and from 3,328 to 12 for a negative glob; scoped and negative glob discovery improved by about 12.5% and 6.1%. End-to-end formatting remains within normal run-to-run variance because I/O and formatting dominate.

@cloudflare-workers-and-pages

Copy link
Copy Markdown

Deploying rstack-cli with  Cloudflare Pages  Cloudflare Pages

Latest commit: 3d51f47
Status: ✅  Deploy successful!
Preview URL: https://39853c8d.rstack-cli.pages.dev
Branch Preview URL: https://chenjiahan-perf-fmt-discover.rstack-cli.pages.dev

View logs

@chenjiahan
chenjiahan merged commit c62e4d9 into main Aug 6, 2026
4 checks passed
@chenjiahan
chenjiahan deleted the chenjiahan/perf-fmt-discovery-resolver branch August 6, 2026 02:14
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