[Python-Dev] urllib2 EP + decr. startup time
Phillip J. Eby
pje at telecommunity.com
Fri Feb 16 18:55:32 CET 2007
At 07:29 PM 2/16/2007 +0200, KoDer wrote:
>2007/2/16, Phillip J. Eby <pje at telecommunity.com>:
> > At 04:38 PM 2/16/2007 +0200, KoDer wrote:
>.....
> >
> >
> > Also, are you aware that putting a zipped version of the standard library
> > on sys.path already speeds up startup considerably? Python since 2.3
> > automatically includes an appropriate entry in sys.path:
> >
>
>zipped version has one weakness - you can't put .so(or dll) files inside.
>In my system 19 from 25 installed egg add directories ,not archives
>(because it's contain dll ).
There's something wrong there. You can put .so, .dll, or .pyd files in
eggs - they get extracted to a cache directory automatically, but those
directories *don't* get added to sys.path.
The mere presence of such files is not enough to cause an egg to be
installed unzipped. The package has to be using things like __file__, the
package author has to have marked it zip-unsafe, or easy_install was
invoked with a request to install unzipped. As long as none of these
conditions apply, the egg should be installed zipped, with dynamic
libraries automatically extracted on-demand to the $PYTHON_EGG_CACHE.
>But even without egg directories >>
>['',
>'C:\\Python25\\Scripts',
>'C:\\WINDOWS\\system32\\python25.zip',
>'C:\\Python25\\DLLs',
>'C:\\Python25\\lib',
>'C:\\Python25\\lib\\plat-win',
>.........
>'C:\\Python25\\lib\\site-packages\\wx-2.8-msw-unicode']
>len(sys.path) == 18 (without eggs) near 18 / 2 = 9 'file not found' errors
> for every first module import.
That depends on what the module is. In the path you've shown, having a
python25.zip would allow only 2 failures before each stdlib import. (Note
that an failed zipfile imports are roughly equivalent to a dictionary
lookup in time - they don't access the filesystem once the zipfile index is
loaded).
>So improvement of setuptools will help, but not solve this problem .
Right -- most of your problem will be solved by creating
'C:\\WINDOWS\\system32\\python25.zip', containing the contents of
C:\\Python25\\lib\\.
Hm. Interesting, actually. Does anybody know why it's looking for
'C:\\WINDOWS\\system32\\python25.zip'? That seems wrong to me.
More information about the Python-Dev
mailing list