bpo-30340: Enhanced regular expressions optimization. by serhiy-storchaka · Pull Request #1542 · python/cpython (original) (raw)
mschwager added a commit to duo-labs/dlint that referenced this pull request
$ 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