-
-
Notifications
You must be signed in to change notification settings - Fork 775
perf: try to create native regex instead of regress regex #11292
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
✅ Deploy Preview for rspack ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR introduces a performance optimization by implementing a hybrid regex approach that attempts to create native Rust regex first before falling back to the existing regress-based implementation. The change restructures RspackRegex
from a single implementation to an enum that can handle both native and regress regex variants.
- Restructures
RspackRegex
as an enum withRegex
(native) andRegress
(fallback) variants - Implements native regex creation with proper flag handling and error fallback
- Updates API consumers to use accessor methods instead of direct field access
Reviewed Changes
Copilot reviewed 4 out of 5 changed files in this pull request and generated 3 comments.
File | Description |
---|---|
crates/rspack_regex/src/lib.rs | Core refactoring to enum-based approach with native regex priority |
crates/rspack_regex/src/napi.rs | Updates to use accessor methods for flags and source |
crates/rspack_regex/Cargo.toml | Adds regex dependency for native implementation |
crates/rspack_binding_api/src/raw_options/raw_builtins/raw_lazy_compilation.rs | Updates to use accessor methods |
📦 Binary Size-limit
❌ Size increased by 142.25KB from 47.64MB to 47.78MB (⬆️0.29%) |
CodSpeed Performance ReportMerging #11292 will not alter performanceComparing 🎉 Hooray!
|
76c0890
to
c65ed39
Compare
a348c67
to
28dd463
Compare
📝 Benchmark detail: Open
Threshold exceeded: ["10000_production-mode_persistent-hot + exec"] |
// global: default in rust, ignore | ||
'g' => {} | ||
// case-insensitive: letters match both upper and lower case | ||
'i' => applied_flags.push('i'), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Summary
algo
and its fast path logic because native regex is fast enoughRelated links
Checklist