Skip to content

bpo-30340: Enhanced regular expressions optimization.#1542

Merged
serhiy-storchaka merged 6 commits into
python:masterfrom
serhiy-storchaka:re-parse-optimize-groups
May 14, 2017
Merged

bpo-30340: Enhanced regular expressions optimization.#1542
serhiy-storchaka merged 6 commits into
python:masterfrom
serhiy-storchaka:re-parse-optimize-groups

Conversation

@serhiy-storchaka
Copy link
Copy Markdown
Member

This increased the performance of matching some patterns up to 25 times.

This increased the performance of matching some patterns up to 25 times.
@serhiy-storchaka serhiy-storchaka added the performance Performance or resource usage label May 11, 2017
@mention-bot
Copy link
Copy Markdown

@serhiy-storchaka, thanks for your PR! By analyzing the history of the files in this pull request, we identified @niemeyer, @birkenfeld and @rhettinger to be potential reviewers.

@serhiy-storchaka serhiy-storchaka merged commit 821a9d1 into python:master May 14, 2017
@serhiy-storchaka serhiy-storchaka deleted the re-parse-optimize-groups branch May 14, 2017 05:32
mschwager added a commit to duo-labs/dlint that referenced this pull request Dec 28, 2019
$ python --version
Python 3.6.9
$ time python -c "import re; re.search(r'([a-c]|[c-e])+z', 'c' * 64)"
*Spins*...
$ time python -c "import re; re.search(r'(c|[c-e])+z', 'c' * 64)"
*Spins*...

$ python --version
Python 3.7.4
$ time python -c "import re; re.search(r'([a-c]|[c-e])+z', 'c' * 64)"
real	0m 0.09s
user	0m 0.07s
sys	0m 0.01s
$ time python -c "import re; re.search(r'(c|[c-e])+z', 'c' * 64)"
real	0m 0.04s
user	0m 0.03s
sys	0m 0.01s

For more information see python/cpython#1542
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

performance Performance or resource usage

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants