-
-
Notifications
You must be signed in to change notification settings - Fork 8.6k
[java] Use static Patterns for regex-matching #15499
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
Conversation
PR Reviewer Guide 🔍Here are some key observations to aid the review process:
|
PR Code Suggestions ✨Explore these optional code suggestions:
|
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.
Thank you, @zodac
Motivation and Context
There were several locations where
Pattern
objects were being used to perform regex matches. This is inefficient as thePattern
would be recompiled on each call. I've extracted these to constants in the appropriate class to ensure they are only compiled once. In one case there was a regex being used to check for digits, which I've replaced with a simple non-regex based function which should be less complex.Types of changes
Checklist
bazel test //java/... --test_size_filters=small
)