Issue 34636: re module microoptimization: speed up bytes \w \s \d matching (original) (raw)
Issue34636
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) * ![]() |
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) * ![]() |
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:05 | admin | set | github: 78817 |
2018-09-12 00:14:20 | gregory.p.smith | set | status: open -> closedresolution: fixedstage: commit review |
2018-09-11 22:48:03 | miss-islington | set | nosy: + miss-islingtonmessages: + |
2018-09-11 22:01:28 | gregory.p.smith | set | messages: + |
2018-09-11 22:00:58 | gregory.p.smith | create |