performance of python code on the NanoNote

Alan Post alanpost at sunflowerriver.org
Tue Sep 14 13:17:22 EDT 2010


I've been testing the makfa package.  The code is running very
slowly, taking many seconds to return a simple result.  It is
too slow for me to use as is.

Since it is a python application, I am able to use the python
profiler to immediately see what is going on:

python -m cProfile -s time /usr/bin/makfa console > makfa.profile
<<EOF
tricu
makfa
EOF

I've attached the profile, but I'll summarize it here:

* I read the entire database off disk, which takes 13 seconds.
* Several other routines, all containing regular expressions,
  take another 13 seconds to burn through the data after I've
  read the database.

Both of these problems are something that I can correct.  I can
convert the pickle file to a sql database, and I can reword or
precompile the regular expressions.  I could remove some of the
whole-table searching the application performs to reduce the number
of calls to these routines.  None of these things have been done
because the application runs fast enough on a desktop machine.

I'd like to ask a question to those of you with more experience
developing on embedded systems with small memory and slow CPUs:

The fact that this application was written in Python means I got
profiling information the moment I discovered there was a problem.
I could look at the code right away and begin to see how I could
fix it.  I'm really pleased at how quickly I was able to figure
out what was going on.

I could fix all of this and still find that I'm not happy with the
performance.  I've never tried optimizing python and I'm not sure
it will run fast enough for me.

I'd love to know that I could use this kind of rapid prototype
environment (python) and get acceptable performance.  Can I?
Will you share your experiences working with interpreted languages
in an embedded environment?

-Alan
-- 
.i ko djuno fi le do sevzi




More information about the discussion mailing list


interactive