Hi<div><br></div><div>I have previously asked this question in python-list, however I think it belongs here.</div><div><br></div><div>I&#39;m running python 2.7.1 on an embedded Linux board and noticed it takes 1.8 seconds to execute the most simple &quot;Hello World&quot; script.</div>
<div><br></div><div>Platform:</div><div>cpu: 200Mhz ARM (ARM926EJ-)</div><div>kernel: 2.6.38</div><div>uClibc: 0.92.1-rc2</div><div><br></div><div><br></div><div>Using strace I found that python is attempting to open 168 non-existent files during startup, see trace:</div>
<div><a href="http://www.veritrack.co.uk/static/images/strace-hello-py.txt">http://www.veritrack.co.uk/static/images/strace-hello-py.txt</a></div><div><br></div><div>I think this is normal behavior but more noticeable due to the embedded environment. </div>
<div><br></div><div><br></div><div>1. Is there anything I can do at compile time to tell Python these files don&#39;t exist and avoid trying to open them?</div><div>2. Is it possible to make python first try and open the &quot;.pyc&quot; and only then look for &quot;.py&quot; ?</div>
<div><br></div><div><br></div><div><br></div><div><div>[root@vx-200 /]# cat hello.py</div><div>#!/usr/bin/python</div><div><br></div><div>print &quot;Hello World!!&quot;</div><div>[root@vx-200 /]#</div></div><div><br></div>
<div><br></div><div><div>[root@vx-200 /]# time ./hello.py</div><div>Hello World!!</div><div><br></div><div>real    0m1.781s</div><div>user    0m1.530s</div><div>sys     0m0.230s</div></div><div><br></div><div><br></div><div>
<br></div><div>Thanks</div><div>Bruce</div><div><br></div><div><br></div><div><br></div>