Subject: Re: python startup time - DN [1]


"Gordon McMillan" <gmcm@hypernet.com> - 19 Mar 2000 - comp.lang.python

 Quinn Dunkan asks:

 > Why does the python take so long to start up?  Is it because it loads so many
 > modules?  And if that is the case, why is module loading slow?

 Partly.

 There are 2 big factors. First is getpath.c, which attempts to
 ascertain as completely as possible what the proper sys.path
 is on your machine, and defends itself against sys admin-ish
 tricks, developers running from strange places, damaged
 OSes and other factors. It does a lot of hunting and pecking in
 the process. If you're willing to live with some simple rules,
 you can cut much of that out.

 Imports can also be a problem. For each entry in sys.path,
 Python will first try for c extensions, then pure Python
 modules (which takes checking the .py against the .pyc /
 .pyo). On both my NT box and my Linux box, I've put the
 standard lib in a .pyz (an archive of compressed .pyc's) which
 is much, much faster. This is all straight out of the installer
 stuff on my starship pages (using Greg Stein's imputil module).

 - Gordon

Last modified
2000-07-20

(195.108.246.52)

Note: you are looking at
the snapshot of an old wiki
- much of this information
is likely to be very outdated