Message359210
In the re module, re._compile gets called when using most re methods.
In my use case (which I think is not rare) I have a small number of compiled patterns that I have to match against a large number of short strings
profiling showed that half of the total runtime was still spent in re._compile, checking for the type of the flags and trying to get the pattern in a cache
Example code that exhibits this behavior:
import re
pattern = re.compile("spam")
string = "Monty pythons"
for _ in range(1000000):
re.search(pattern, string) |
|
Date |
User |
Action |
Args |
2020-01-02 18:59:30 | Recursing | set | recipients:
+ Recursing |
2020-01-02 18:59:30 | Recursing | set | messageid: <1577991570.36.0.292103009672.issue39195@roundup.psfhosted.org> |
2020-01-02 18:59:30 | Recursing | link | issue39195 messages |
2020-01-02 18:59:30 | Recursing | create | |
|