[issue30340] Optimize out non-capturing groups

2017-05-13 Thread Serhiy Storchaka
Changes by Serhiy Storchaka : -- resolution: -> fixed stage: patch review -> resolved status: open -> closed ___ Python tracker ___ _

[issue30340] Optimize out non-capturing groups

2017-05-13 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: New changeset 821a9d146bc04a1bc1a9807962990a1f59d692b8 by Serhiy Storchaka in branch 'master': bpo-30340: Enhanced regular expressions optimization. (#1542) https://github.com/python/cpython/commit/821a9d146bc04a1bc1a9807962990a1f59d692b8 -- __

[issue30340] Optimize out non-capturing groups

2017-05-11 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Good catch Josh! This return was temporary added for debugging, the function should actually uniqify. -- ___ Python tracker ___ _

[issue30340] Optimize out non-capturing groups

2017-05-11 Thread Josh Rosenberg
Josh Rosenberg added the comment: The PR includes defining and using a _uniq function that is actually a no-op function (it doesn't uniquify, the first line returns the argument, so the rest is skipped). Was that supposed to be removed, or should it actually uniqify? -- nosy: +josh.r

[issue30340] Optimize out non-capturing groups

2017-05-11 Thread Serhiy Storchaka
Changes by Serhiy Storchaka : -- pull_requests: +1641 ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: https://m

[issue30340] Optimize out non-capturing groups

2017-05-11 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: $ ./python -m timeit -s "import re; p = re.compile(r'[a-z]|[0-9]'); s = ' '*1+'x'" "p.search(s)" Unpatched: 500 loops, best of 5: 732 usec per loop Patched:1000 loops, best of 5: 279 usec per loop -- ___

[issue30340] Optimize out non-capturing groups

2017-05-11 Thread Serhiy Storchaka
New submission from Serhiy Storchaka: Proposed patch makes the regular expression parser produce more optimal tree, mainly due to getting rid of non-capturing groups. This allows to apply an optimization that was forbidden before and makes the regular expression compiler producing more efficie