News for hackers. Stuff that matters.
Re:Python to get Google-backed speedup by CUViper on Saturday June 13, 2009 @09:30PM (#656677)
Aha -- I almost suggested that they could do some memoization, and indeed they are doing just that. The last 100 unique patterns are compiled and stored in a dictionary for future use. You could still thrash badly if your regex "working set" is more than 100 patterns, but for most people it's probably Good Enough. (Plus you could override re._MAXCACHE if you really want.)

Thanks for pointing out my error, and getting me to read the actual code instead of speculating. :)

There are no comments on this comment yet.