INADA Naoki <songofaca...@gmail.com> added the comment:

> In my tests, a helloworld python script generally takes about 30-40 ms.
[snip]
> 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.

What is your environment?
I optimized startup on Python 3.7, especially on macOS (it was very slow before 
3.7).

And some legacy features (e.g. legacy "namespace package" system from 
setuptools) will make startup much slower, because they import some heavy 
libraries silently even when you just run "hello world".

PYTHONPROFILEIMPORTTIME will help to find them too.  And venv allow to split 
out such legacy tools from your main Python environment.

> 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. 

Would you give us some example script?

> 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.

FYI, it compiles many regular expressions at startup time.
I want to add lazy compilation API to re module in 3.8.  (I'm waiting bpo-21145 
is implemented)

----------

_______________________________________
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