◐ Shell
clean mode source ↗

Message 174927 - Python tracker

I think the lru_cache should be kept if possible (i.e. I'm -0.5 on your patch).  If this result in a slowdown (as the mako_v2 benchmark indicates), then there are two options:
  1) optimize lru_cache;
  2) avoid using it for regular expressions compiled with re.compile;
Both the changes should improve the performances.
This issue is about the re module, so I think it's ok to cover any changes to the re module here, and improvements to lru_cache (e.g. a faster make_key) should be moved to a new issue.
If this is not enough to restore the performances we might decide to go back to a custom cache instead of using lru_cache.