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?
to your account
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
assignee = 'https://github.com/serhiy-storchaka'
closed_at = <Date 2014-10-10.08:46:47.543>
created_at = <Date 2013-10-24.20:14:19.696>
labels = ['expert-regex', 'library', 'performance']
title = 'Optimize parsing of regular expressions'
updated_at = <Date 2014-10-10.08:46:47.541>
user = 'https://github.com/serhiy-storchaka'
activity = <Date 2014-10-10.08:46:47.541>
actor = 'serhiy.storchaka'
assignee = 'serhiy.storchaka'
closed = True
closed_date = <Date 2014-10-10.08:46:47.543>
closer = 'serhiy.storchaka'
components = ['Library (Lib)', 'Regular Expressions']
creation = <Date 2013-10-24.20:14:19.696>
creator = 'serhiy.storchaka'
dependencies = 
files = ['32341', '32343', '36649', '36818', '36843']
hgrepos = 
issue_num = 19380
keywords = ['patch', 'needs review']
message_count = 13.0
messages = ['201177', '201183', '201191', '201192', '201227', '206557', '227032', '227041', '227053', '228605', '228838', '228964', '228971']
nosy_count = 7.0
nosy_names = ['pitrou', 'vstinner', 'ezio.melotti', 'mrabarnett', 'python-dev', 'serhiy.storchaka', 'josh.r']
pr_nums = 
priority = 'normal'
resolution = 'fixed'
stage = 'resolved'
status = 'closed'
superseder = None
type = 'performance'
url = 'https://bugs.python.org/issue19380'
versions = ['Python 3.5']
The text was updated successfully, but these errors were encountered:
Proposed patch optimizes parsing of regular expressions. Total time of re unittests decreased by 10%.
Sorry, something went wrong.
I don't think "+=" speeds up anything for ints, you might as well minimize code churn by avoiding such changes.
Do you have any benchmark figures (apart from the time of re unittests)?
### regex_compile ###
Min: 2.897919 -> 2.577488: 1.12x faster
Avg: 3.066306 -> 2.681966: 1.14x faster
Stddev: 0.08789 -> 0.05085: 1.7283x smaller
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':
Issue bpo-19380: Optimized parsing of regular expressions.
Thank you for your reviews Yury, Josh, and Antoine.
No branches or pull requests