-
Notifications
You must be signed in to change notification settings - Fork 374
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
refactor: compile all regexes at init #1592
Conversation
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## master #1592 +/- ##
==========================================
- Coverage 55.80% 55.79% -0.01%
==========================================
Files 436 436
Lines 66168 66156 -12
==========================================
- Hits 36922 36913 -9
+ Misses 26356 26355 -1
+ Partials 2890 2888 -2
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
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.
Looks great 💯
This PR changes all regexes (except for some in test files) in the code to make them compile at init. This, aside from giving a slight performance optimisation by skipping the compile stage on execution, allows also to ensure that the regexes themselves are correct by panicking at program start-up if they are not. (before this PR, in almost every instance where we used `regexp.MatchString` or similar, we did not check the error).
This PR changes all regexes (except for some in test files) in the code to make them compile at init.
This, aside from giving a slight performance optimisation by skipping the compile stage on execution, allows also to ensure that the regexes themselves are correct by panicking at program start-up if they are not. (before this PR, in almost every instance where we used
regexp.MatchString
or similar, we did not check the error).