[Python-Dev] Python startup time

yoav glazner yoavglazner at gmail.com
Thu Oct 10 06:41:19 CEST 2013


I'm not sure Droping imports is the best way to go, since every python
script/app will import common modules right on the start and it will still
seem like the interpeter boot is slow.

making modules load faster seems like a better approch




On Thu, Oct 10, 2013 at 3:18 AM, Eric Snow <ericsnowcurrently at gmail.com>wrote:

> On Wed, Oct 9, 2013 at 8:30 AM, Christian Heimes <christian at python.org>
> wrote:
> > The os module imports MutableMapping from collections.abc. That import
> > adds collections, collections.abc and eight more modules. I'm not sure
> > if we can do anything about it, though.
>
> Well, that depends on how much we want to eliminate those 10 imports.
> :)  Both environ and environb could be turned into lazy wrappers
> around an _Environ-created-when-needed.  If we used a custom module
> type for os [1], then adding descriptors for the two attributes is a
> piece of cake.  As it is, with a little metaclass magic (or even with
> explicit wrapping of the various dunder methods), we could drop those
> 10 imports from startup.
>
> -eric
>
> [1] This probably wouldn't be a great idea considering that
> undoubtedly some code depends on "type(os) is types.ModuleType".
> _______________________________________________
> 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/yoavglazner%40gmail.com
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-dev/attachments/20131010/627ccdeb/attachment-0001.html>


More information about the Python-Dev mailing list