This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author methane
Recipients barry, cykerway, methane, ncoghlan, terry.reedy, vstinner
Date 2018-08-06.10:12:37
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
> In my tests, a helloworld python script generally takes about 30-40 ms.
> 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)
Date User Action Args
2018-08-06 10:12:38methanesetrecipients: + methane, barry, terry.reedy, ncoghlan, vstinner, cykerway
2018-08-06 10:12:38methanesetmessageid: <>
2018-08-06 10:12:38methanelinkissue34296 messages
2018-08-06 10:12:37methanecreate