[Python-Dev] this is what happens if you freeze all the modules required for startup

Dr. Brett Cannon bcannon at gmail.com
Wed Apr 16 21:10:28 CEST 2014


Is this Python 2 or 3? In Python 2 it means an attempt to perform a
relative import failed but an absolute in succeeded, e.g. from idlelib you
imported os, so import tried idlelib.is and then os. You should definitely
consider using a future import to guarantee absolute imports.

On Wednesday, April 16, 2014 2:57:35 PM, Terry Reedy <tjreedy at udel.edu>
wrote:

> On 4/16/2014 12:25 PM, "Martin v. Löwis" wrote:
> > Am 14.04.14 23:51, schrieb Brett Cannon:
> >> It was realized during PyCon that since we are freezing importlib we
> >> could now consider freezing all the modules to cut out having to stat or
> >> read them from disk.
> > [...]
> >> Thoughts?
> >
> > They still get read from disk, except that it is the operating system
> > that does the reading. So what you really save is the access to many
> > tiny files; something that can also be achieved with the zipfile import.
> > So I wonder how your all-frozen binary compares to a standard binary
> > with a python35.zip.
> >
> > If it is comparable, I'd rather extend on that route, i.e. promote
> > putting the standard library into a zip file in the default
> > installation, and also find a way where (say) /usr/bin/hg could
> > conveniently specify a zip file that will contain the Mercurial
> > byte code. For example, we could support a -Z option for the interpreter
> > which would allow to append a zip file to a script that gets put on
> > sys.path.
>
> This could be useful for Idle also, as its startup is noticeably
> sluggish and could definitely stand to be zippier. About 50 Idle modules
> are imported in the user process and, I presume, at least as many in the
> Idle process.
>
> PS. In the user process sys.modules, there are numerous null entries
> like these:
>  >>> sys.modules['idlelib.os']
>  >>> sys.modules['idlelib.tokenize']
>  >>> sys.modules['idlelib.io']
>  >>> <etcetera>
>
> Does anyone know the most likely reason?
>
> --
> Terry Jan Reedy
>
>
> _______________________________________________
> Python-Dev mailing list
> Python-Dev at python.org
> https://mail.python.org/mailman/listinfo/python-dev
> Unsubscribe: https://mail.python.org/mailman/options/python-dev/
> brett%40python.org
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-dev/attachments/20140416/c4e6b293/attachment.html>


More information about the Python-Dev mailing list