10.04.18 20:38, Chris Angelico пише:
On Wed, Apr 11, 2018 at 2:14 AM, Serhiy Storchaka <storch...@gmail.com> wrote:
A deployed Python distribution generally has .pyc files for all of the
standard library. I don't think people want to lose the ability to
call help(), and unless I'm misunderstanding, that requires
docstrings. So this will mean twice as many files and twice as many
file-open calls to import from the standard library. What will be the
impact on startup time?

Yes, this will mean more syscalls when import with docstrings. But the startup time doesn't matter for interactive shell in which you call help(). It was expected that programs which need to gain the benefit from separating optional components will run without loading them (like with option -OO).

The overhead can be reduced by packing multiple files in a single archive.

Finally, loading docstrings and other optional components can be made lazy. This was not in my original idea, and this will significantly complicate the implementation, but in principle it is possible. This will require larger changes in the marshal format and bytecode. This can open a door for further enhancements: loading the code and building classes and other complex data (especially heavy namedtuples, enums and dataclasses) on demand. Often you need to use just a single attribute or function from a large module. But this is different change, out of scope of this topic.

_______________________________________________
Python-ideas mailing list
Python-ideas@python.org
https://mail.python.org/mailman/listinfo/python-ideas
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to