[Python-Dev] Python startup optimization: script vs. service
gwk.lists at gmail.com
Mon Oct 2 11:12:48 EDT 2017
Fair, but can you justify your preference? From my perspective, I write many small command line scripts, and all of them would benefit from faster load time. Am I going to have to stick mode-setting incantations at the top of every single one? I occasionally write simple servers, and none of them would suffer for having the first request respond slightly slowly. In many cases they have slow first response times anyway due to file system warmup, etc.
> On Oct 2, 2017, at 10:48 AM, Christian Heimes <christian at python.org> wrote:
> On 2017-10-02 14:05, George King wrote:
>> I’m new to this issue, but curious: could the long-running server
>> mitigate lazy loading problems simply by explicitly importing the
>> deferred modules, e.g. at the top of __main__.py? It would require some
>> performance tracing or other analysis to figure out what needed to be
>> imported, but this might be a very easy way to win back response times
>> for demanding applications. Conversely, small scripts currently have no
> 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.
More information about the Python-Dev