-
-
Notifications
You must be signed in to change notification settings - Fork 30.9k
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
Optimize parsing of regular expressions #63579
Comments
Proposed patch optimizes parsing of regular expressions. Total time of re unittests decreased by 10%. |
I don't think "+=" speeds up anything for ints, you might as well minimize code churn by avoiding such changes. |
Done. |
Do you have any benchmark figures (apart from the time of re unittests)? |
### regex_compile ### |
Could someone please make a review? |
Actually "if x:" is slightly faster than "if x is not None:" on current implementation. |
"is not None" is more readable, though. When using plain boolean testing, it's never obvious whether you can have a zero-length string, a null number, etc. |
Well, then please look at re_parse_2.patch (it is still applied cleanly). |
Here is a patch which addresses Yury's and Josh's comments. Also discarded few minor changes. |
Updated patch implements Antoine's suggestions. |
New changeset 1adeac2a8714 by Serhiy Storchaka in branch 'default': |
Thank you for your reviews Yury, Josh, and Antoine. |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: