<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">2017-07-19 16:26 GMT+02:00 Victor Stinner <span dir="ltr"><<a href="mailto:victor.stinner@gmail.com" target="_blank">victor.stinner@gmail.com</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">2017-07-19 15:22 GMT+02:00 Oleg Broytman <<a href="mailto:phd@phdru.name">phd@phdru.name</a>>:<br>
> On Wed, Jul 19, 2017 at 02:59:52PM +0200, Victor Stinner <<a href="mailto:victor.stinner@gmail.com">victor.stinner@gmail.com</a>> wrote:<br>
>> "Python is very slow to start on Windows 7"<br>
>> <a href="https://stackoverflow.com/questions/29997274/python-is-very-slow-to-start-on-windows-7" rel="noreferrer" target="_blank">https://stackoverflow.com/<wbr>questions/29997274/python-is-<wbr>very-slow-to-start-on-windows-<wbr>7</a><br>
><br>
>    However hard you are going to optimize Python you cannot fix those<br>
> "defenders", "guards" and "protectors". :-) This particular link can be<br>
> excluded from consideration.<br>
<br>
</span>Sorry, I didn't read carefully each link I posted. Even for me knowing<br>
what Python does at startup, it's hard to explain why 3 people have<br>
different timing: 15 ms, 75 ms and 300 ms for example. In my<br>
experience, the following things impact Python startup:<br>
<br>
* -S option: loading or not the site module<br>
* Paths in sys.path: PYTHONPATH environment variable for example<br>
* .pth files files in sys.path<br>
* Python running in a virtual environment or not<br>
* Operating system: Python loads different modules at startup<br>
depending on the OS. Naoki INADA just removed _osx_support from being<br>
imported in the site module on macOS for example.<br>
<br>
My list is likely incomplete.<br>
<br>
In the performance benchmark suite, a controlled virtual environment<br>
is created to have a known set of modules. FYI running Python is a<br>
virtual environment is slower than "system" python which runs outside<br>
a virtual environment...<br>
<span class="HOEnZb"><font color="#888888"><br>
Victor<br>
</font></span><div class="HOEnZb"><div class="h5"><br></div></div></blockquote><div>Hi Victor,</div><div><br></div><div>I assume that Python loads compiled (.pyc and/or .pyo) from the stdlib. That's something that also influences the startup time (compiling source vs loading pre-compiled modules).</div><div><br></div><div>Bests,</div><div>Cesare </div></div></div></div><div id="DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2"><br> <table style="border-top:1px solid #d3d4de">
        <tr>
      <td style="width:55px;padding-top:18px"><a href="https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail" target="_blank"><img src="https://ipmcdn.avast.com/images/icons/icon-envelope-tick-round-orange-animated-no-repeat-v1.gif" alt="" width="46" height="29" style="width: 46px; height: 29px;"></a></td>
                <td style="width:470px;padding-top:17px;color:#41424e;font-size:13px;font-family:Arial,Helvetica,sans-serif;line-height:18px">Mail priva di virus. <a href="https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail" target="_blank" style="color:#4453ea">www.avast.com</a>          </td>
        </tr>
</table>
<a href="#DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2" width="1" height="1"></a></div>