[Python-Dev] 2.3 startup speed?

Skip Montanaro skip@pobox.com
Fri, 11 Jul 2003 09:55:04 -0500


    Jeremy> The two default filters use the regular expression "".  So we're
    Jeremy> getting absolutely no benefit from those regular expressions.  I
    Jeremy> propose to modify the two regex slots in the filter tuple to
    Jeremy> also store None, where None means matching anything.

Why bother compiling the regular expressions ahead of time?  Just store
strings and use re.match(...) instead of pat.match(...).  When you encounter
a potential warning you want to suppress, I suspect it's not generally going
to be in a speed critical part of the system.  If it is a potential
performance issue, the re module will have the compiled regular expression
in its cache.

Skip