[Python-Dev] Embedded Python startup is slow

bruce bushby bruce.bushby at gmail.com
Thu Mar 24 18:39:52 CET 2011


I used the most simple "Hello World" program as a benchmark for "bare bones"
Python __initialization__...nothing more.

On my pc, the "Hello World" script obviously executes very quickly....so
trying to open 160 odd files that don't exist is negligible, but it still
happens.

 "...How did you measure that?..."
I used "strace -c hello.py"

This is not a dig at Python, I love Python....I was asking if I had missed a
compile option or implementation trick.


Bruce





On Thu, Mar 24, 2011 at 5:05 PM, Stefan Behnel <stefan_ml at behnel.de> wrote:

> bruce bushby, 24.03.2011 16:58:
>
>  My main concern was that a freshly compiled Python attempts to open 168
>> non-existent files before starting.
>>
>> I understand that an interpreted language is probably not the best choice
>> for an embedded device
>>
>
> Well, "hello world" isn't exactly the benchmark I'd use for an embedded
> system.
>
>
>
>  On my desktop pc, when I run the most simple "Hello World" .... 78% of the
>> overall execution time is spent opening files....most of which don't
>> exist.
>>
>
> How did you measure that?
>
> I'd expect that after the first startup, most of the relevant parts of the
> file system are cached by the OS, so a subsequent run should be quick as all
> file existence tests will run from memory. Sure, it's a bit of overhead to
> call into the OS, and I don't know how expensive that is on ARM-Linux, but
> given that you also claim it to be expensive on your desktop, I must say
> that I'm a bit surprised about your above claim.
>
> Stefan
>
> _______________________________________________
> Python-Dev mailing list
> Python-Dev at python.org
> http://mail.python.org/mailman/listinfo/python-dev
> Unsubscribe:
> http://mail.python.org/mailman/options/python-dev/bruce.bushby%40gmail.com
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-dev/attachments/20110324/1fc4430f/attachment.html>


More information about the Python-Dev mailing list