[Python-Dev] Rethinking intern() and its data structure

Guido van Rossum guido at python.org
Fri Apr 10 06:26:53 CEST 2009

On Thu, Apr 9, 2009 at 9:07 PM, Collin Winter <collinw at gmail.com> wrote:
> On Thu, Apr 9, 2009 at 6:24 PM, John Arbash Meinel <john.arbash.meinel at gmail.com> wrote:

> >And I would be a *lot* happier if startup time was 100ms instead
> > of 400ms.
> Quite so. We have a number of internal tools, and they find that
> frequently just starting up Python takes several times the duration of
> the actual work unit itself. I'd be very interested to review any
> patches you come up with to improve start-up time; so far on this
> thread, there's been a lot of theory and not much practice. I'd
> approach this iteratively: first replace the dict with a set, then if
> that bears fruit, consider a customized data structure; if that bears
> fruit, etc.
> Good luck, and be sure to let us know what you find,

Just to add some skepticism, has anyone done any kind of
instrumentation of bzr start-up behavior?  IIRC every time I was asked
to reduce the start-up cost of some Python app, the cause was too many
imports, and the solution was either to speed up import itself (.pyc
files were the first thing ever that came out of that -- importing
from a single .zip file is one of the more recent tricks) or to reduce
the number of modules imported at start-up (or both :-). Heavy-weight
frameworks are usually the root cause, but usually there's nothing
that can be done about that by the time you've reached this point. So,
amen on the good luck, but please start with a bit of analysis.

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

More information about the Python-Dev mailing list