embedded python 2.7.1 slow startup

Terry Reedy tjreedy at udel.edu
Tue Mar 8 15:23:06 EST 2011


On 3/8/2011 4:06 AM, bruce bushby wrote:
> Hi
>
> I've been playing with running python on embedded linux. I thought I
> would run some "straces" to see how the install went when I noticed
> python attempts to "open"
> loads of files that don't exist.....is there a way to prevent these
> "open" attempts....they're responsible for 40% of my scripts execution time.
>
> I was wondering if there is a way to prevent python from attempting to
> open files I know are not there?

The problem is that *python* does not know. Most of the failed attempts 
are from looking for a compiled shared library version of every module 
to be imported. I wonder if it would be faster to make a set with all 
shared library names and check that instead before going to the file 
system. On an embedded system, especially, something might even be built 
into the binary or read at startup.

-- 
Terry Jan Reedy




More information about the Python-list mailing list