[Python-Dev] 2.3 startup speed?

Guido van Rossum guido@python.org
Fri, 11 Jul 2003 12:45:51 -0400

> I've got a plan, which I'll implement today unless someone can find a
> hole in it.  The warnings module stores 5-tuples of filter information,
> including two compiled regular expressions.  There are two filters
> installed by default, which is why we load re during startup.
> The two default filters use the regular expression "".  So we're getting
> absolutely no benefit from those regular expressions.   I propose to
> modify the two regex slots in the filter tuple to also store None, where
> None means matching anything.
> If we make that change, then we can install the default filters without
> importing re.  A quick test of this change improved startup time by 20%.

It seems you already implemented this; I approve (though I hope some
other folks will carefully review the changes to warnings.py, which
are a bit more extensive than I feel comfortable with this close to a

> Unfortunately, even with a 20% boost, it still takes twice as long to do
> python -c "pass".

There's a little time for more research into this.

--Guido van Rossum (home page: http://www.python.org/~guido/)