Cyker Way <cyker...@gmail.com> added the comment:

>   VM startup + `import site` are done in 10~20ms on common Linux machine.

>   While Python VM startup is not lightning fast, library import time is much 
> slower than VM startup in many cases.

In my tests, a helloworld python script generally takes about 30-40 ms, while a 
similar helloworld bash script takes about 3-4 ms. Adding some common library 
imports (`os`, `sys`, etc.), then the python script's running time goes up to 
60-70ms. I'm not sure how to compare this against bash because there are no 
library imports in bash. The 500ms (python) vs 50ms (bash) comparison is based 
on minimal implementations of the same simple job and meant to reflect the 
minimal amount of time needed for such a job in different languages. While it 
doesn't cover everything and may not even be fair enough, the result does match 
that of the helloworld test (10 times faster/slower). Plus, in your linked 
post, it shows importing pipenv takes about 700ms. Therefore I believe some 
hundreds of milliseconds are necessary for such scripts that do a simple but 
meaningful job.

I understand many things can happen while importing a library. But for a 
specific program, its imports are usually fixed and very much likely the same 
between runs. That's why I believe a zygote/fork/snapshot feature would still 
be helpful to help avoid the startup delay.

Finally, for simple and quick user scrips, the 30-40 ms startup time without 
any import statements may not be a huge problem, but it's still tangible and 
makes the program feel not that sleek.

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue34296>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to