Skip to content

perf(fmt): move gitignore matching to Rust - #318

Merged
chenjiahan merged 1 commit into
mainfrom
chenjiahan/perf-fmt-native-gitignore
Aug 11, 2026
Merged

perf(fmt): move gitignore matching to Rust#318
chenjiahan merged 1 commit into
mainfrom
chenjiahan/perf-fmt-native-gitignore

Conversation

@chenjiahan

Copy link
Copy Markdown
Member

Summary

This PR moves repository .gitignore hierarchy matching for rs fmt from ignore@7.0.6 to Rust while keeping the native binding lazy. It batches each directory across N-API, preserves nested ignore and negation behavior, and removes the JavaScript ignore runtime dependency.

Performance

Warm-filesystem, same-process alternating paired runs; file outputs matched the previous implementation. Negative paired delta means faster.

Repository Files Previous median Current median Paired median delta
Rstack 550 3.49 ms 3.52 ms -1.51%
Rsbuild 3,317 30.23 ms 30.97 ms +3.28%
Rspack 21,140 282.09 ms 152.25 ms -47.08%

Rsbuild made 1,505 native calls for 5,473 entries (3.64 entries per batch), so reducing fixed per-directory bridge overhead remains the main optimization opportunity.

Known gaps

  • Edge-pattern behavior still differs from ignore@7.0.6 for unclosed character classes, braces, Unicode case folding, and escaped trailing spaces.
  • Native matcher failures during ignore-file loading still need explicit propagation instead of being treated as read failures.

Validated with pnpm build, pnpm --filter rstack build:native, pnpm test, pnpm check, and cargo fmt --all -- --check.

@cloudflare-workers-and-pages

Copy link
Copy Markdown

Deploying rstack-cli with  Cloudflare Pages  Cloudflare Pages

Latest commit: 68afa4a
Status: ✅  Deploy successful!
Preview URL: https://7a534b89.rstack-cli.pages.dev
Branch Preview URL: https://chenjiahan-perf-fmt-native-g.rstack-cli.pages.dev

View logs

@chenjiahan
chenjiahan marked this pull request as ready for review August 11, 2026 13:22
@chenjiahan
chenjiahan merged commit c209281 into main Aug 11, 2026
5 checks passed
@chenjiahan
chenjiahan deleted the chenjiahan/perf-fmt-native-gitignore branch August 11, 2026 13:43
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