On Sat, 23 Mar 2013 14:26:30 +0100 Masklinn masklinn@masklinn.net wrote:
Wouldn't it be better if there are *few* different regexes? Since the module itself caches 512 expressions (100 in Python 2) and does not use an LRU or other "smart" cache (it just clears the whole cache dict once the limit is breached as far as I can see), *and* any explicit call to re.compile will *still* use the internal cache (meaning even going through re.compile will count against the _MAXCACHE limit), all regex uses throughout the application (including standard library &al) will count against the built-in cache and increase the chance of the regex we want cached to be thrown out no?
Well, it mostly sounds like the re cache should be made a bit smarter.
Regards
Antoine.