Skip to content
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

perf: reduce regex costs for external #916

Merged
merged 1 commit into from
Feb 27, 2024
Merged

Conversation

PeachScript
Copy link
Member

优化 external 特性中正则表达式实例化的开销(约 50% ↓),对相同的正则表达式做了缓存处理,没用 OnceCell 是因为正则表达式不是全局唯一的,而是每条 external 规则特有的,在 e2e/fixtures/config.externals 中优化前后效果对比:

图片

@xusd320
Copy link
Contributor

xusd320 commented Feb 23, 2024

https://github.com/jaemk/cached/blob/master/src/macros.rs#L238
cached macro 展开应该就是 once cell

@PeachScript
Copy link
Member Author

https://github.com/jaemk/cached/blob/master/src/macros.rs#L238 cached macro 展开应该就是 once cell

原来如此👍

@xusd320 xusd320 merged commit 55a3222 into master Feb 27, 2024
8 checks passed
@delete-merged-branch delete-merged-branch bot deleted the feature/external-perf branch February 27, 2024 10:19
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.

2 participants