Speeding up application startup

Carlos Ribeiro cribeiro at mail.inet.com.br
Mon May 14 17:07:09 EDT 2001


At 07:28 11/05/01 +0000, Fredrik Lundh wrote:
>- try storing them as text strings instead, and use re.match(p, s) instead
>of p.match(s).  you can bump the SRE cache like this:
>
>     import sre
>     sre._MAXCACHE = 15000

I haven't ever heard of this cache mechanism before... it seems to be 
highly useful. How does it work? is it documented?

The original question got me curious, and I have a related question: There 
is any work being done to optimize the regular expression syntax itself? As 
it seems, compiling regular expressions is a relatively 'heavy duty' 
process. It should be possible to have a simpler syntax for it, with a 
representation better suited for fast compilation.

Of course, the actual regular expression syntax is well known. But we 
already have market for several different computer languages. Why not 
propose a different syntax for regular expressions? There are something on 
these lines already happening?

Just-curious,


Carlos Ribeiro






More information about the Python-list mailing list