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 <1533550358.03.0.56676864532.issue34296@psf.upfronthosting.co.za>
In-reply-to
Content
> 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)
History
Date User Action Args
2018-08-06 10:12:38methanesetrecipients: + methane, barry, terry.reedy, ncoghlan, vstinner, cykerway
2018-08-06 10:12:38methanesetmessageid: <1533550358.03.0.56676864532.issue34296@psf.upfronthosting.co.za>
2018-08-06 10:12:38methanelinkissue34296 messages
2018-08-06 10:12:37methanecreate