[Python-Dev] Python startup optimization: script vs. service

Christian Heimes christian at python.org
Mon Oct 2 13:02:42 EDT 2017


On 2017-10-02 16:59, Barry Warsaw wrote:
> On Oct 2, 2017, at 10:48, Christian Heimes <christian at python.org> wrote:
>>
>> That approach could work, but I think that it is the wrong approach. I'd
>> rather keep Python optimized for long-running processes and introduce a
>> new mode / option to optimize for short-running scripts.
> 
> What would that look like, how would it be invoked, and how would that change the behavior of the interpreter?

I haven't given it much thought yet. Here are just some wild ideas:

- add '-l' command line option (l for lazy)
- in lazy mode, delay some slow operations (re compile, enum, ...)
- delay some imports in lazy mode, e.g. with a deferred import proxy

Christian



More information about the Python-Dev mailing list