[issue45462] Speed up re.match with pre-compiled patterns

Serhiy Storchaka report at bugs.python.org
Fri Oct 15 05:22:46 EDT 2021


Serhiy Storchaka <storchaka+cpython at gmail.com> added the comment:

For reference, caching was introduced in b1aa19515ffdb84c6633ee0344196fd8bd50ade0 21 years ago, and initially it checked for pre-compiled patterns before looking up in the cache. But it was changed 2 months later in 7898c3e6852565046a9b8b063d35d66777bf5176 and since then the cache was checked first. There was no explicit note about this in commit message, but I think that it was done to speed up the common case.

There were many changes in the caching mechanism, but this part of logic was left unchanged. Maybe if once we implement fast dispatch by the type of the first argument we reconsider this code.

----------
resolution:  -> rejected
stage: patch review -> resolved
status: open -> closed

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue45462>
_______________________________________


More information about the Python-bugs-list mailing list