bpo-34636: Use fast path for more chars in SRE category macros. by sir-sigurd · Pull Request #9170 · python/cpython (original) (raw)
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 andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Conversation3 Commits2 Checks0 Files changed
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
[ Show hidden characters]({{ revealButtonHref }})
Confirming the microoptimization here with a non-debug (opt) build:
~/oss/cpython$ sre-before/python -m timeit -s "import re; s = (b'~' * 1000000); f = re.compile(b'\s\w\d').search" "f(s)"
20 loops, best of 5: 11 msec per loop
~/oss/cpython$ sre-after/python -m timeit -s "import re; s = (b'~' * 1000000); f = re.compile(b'\s\w\d').search" "f(s)"
20 loops, best of 5: 10.1 msec per loop
Those results are consistent across reruns.
gpshead changed the title
Use fast path for more characters in SRE category macros. bpo-34636: Use fast path for more characters in SRE category macros.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I confirmed that the valued used make sense and match pyctype where the values are defined.
gpshead changed the title
bpo-34636: Use fast path for more characters in SRE category macros. bpo-34636: Use fast path for more chars in SRE category macros.
@sir-sigurd: Status check is done, and it's a success ✅ .