[Python-Dev] Embedded Python startup is slow
bruce bushby
bruce.bushby at gmail.com
Thu Mar 24 09:06:35 CET 2011
Hi
I have previously asked this question in python-list, however I think it
belongs here.
I'm running python 2.7.1 on an embedded Linux board and noticed it takes 1.8
seconds to execute the most simple "Hello World" script.
Platform:
cpu: 200Mhz ARM (ARM926EJ-)
kernel: 2.6.38
uClibc: 0.92.1-rc2
Using strace I found that python is attempting to open 168 non-existent
files during startup, see trace:
http://www.veritrack.co.uk/static/images/strace-hello-py.txt
I think this is normal behavior but more noticeable due to the embedded
environment.
1. Is there anything I can do at compile time to tell Python these files
don't exist and avoid trying to open them?
2. Is it possible to make python first try and open the ".pyc" and only then
look for ".py" ?
[root at vx-200 /]# cat hello.py
#!/usr/bin/python
print "Hello World!!"
[root at vx-200 /]#
[root at vx-200 /]# time ./hello.py
Hello World!!
real 0m1.781s
user 0m1.530s
sys 0m0.230s
Thanks
Bruce
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-dev/attachments/20110324/27c8ec57/attachment.html>
More information about the Python-Dev
mailing list