This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: re module microoptimization: speed up bytes \w \s \d matching
Type: performance Stage: commit review
Components: Versions: Python 3.8
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: gregory.p.smith Nosy List: gregory.p.smith, miss-islington
Priority: normal Keywords:

Created on 2018-09-11 22:00 by gregory.p.smith, last changed 2022-04-11 14:59 by admin. This issue is now closed.

Pull Requests
URL Status Linked Edit
PR 9170 merged gregory.p.smith, 2018-09-11 22:00
Messages (3)
msg325073 - (view) Author: Gregory P. Smith (gregory.p.smith) * (Python committer) Date: 2018-09-11 22:00
filing this issue to track https://github.com/python/cpython/pull/9170
msg325074 - (view) Author: Gregory P. Smith (gregory.p.smith) * (Python committer) Date: 2018-09-11 22:01
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.
msg325086 - (view) Author: miss-islington (miss-islington) Date: 2018-09-11 22:48
New changeset ec014a101a7f6243b95dfc08acfe1542b9fa5d39 by Miss Islington (bot) (Sergey Fedoseev) in branch 'master':
bpo-34636: Use fast path for more chars in SRE category macros. (GH-9170)
https://github.com/python/cpython/commit/ec014a101a7f6243b95dfc08acfe1542b9fa5d39
History
Date User Action Args
2022-04-11 14:59:05adminsetgithub: 78817
2018-09-12 00:14:20gregory.p.smithsetstatus: open -> closed
resolution: fixed
stage: commit review
2018-09-11 22:48:03miss-islingtonsetnosy: + miss-islington
messages: + msg325086
2018-09-11 22:01:28gregory.p.smithsetmessages: + msg325074
2018-09-11 22:00:58gregory.p.smithcreate