#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2005
    Posts
    3
    Rep Power
    0

    Python and Boa on embedded system


    Hi to all,
    my question is a little particular..I have an embedded board (based on motorola coldfire) with installed and running uClinux with Boa and Python. I use python to write CGI program to use with Boa. I have this problem: in run-time I import che cgi module in python, but this importation is very very slow (about 7-8 secs ). The same thing doesn't happens with other modules (like Os, Time).
    Somebody knows why this happens?

    Thanks,bye
    Sandro
  2. #2
  3. Mini me.
    Devshed Novice (500 - 999 posts)

    Join Date
    Nov 2003
    Location
    Cambridge, UK
    Posts
    783
    Rep Power
    13
    I've not run embedded Python but I guess the performance issue is because the CGI mdule is a python text module (which also imports a number of modules) whereas OS and Time will be compiled C modules which are just linked in.

    Does your embedded system preserve the .pyc or .pyo file?

    If it does then I would hope it runs faster the second time the program is run.

    What sort of storage are you using for the programs, flash?

    grim
  4. #3
  5. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2005
    Posts
    3
    Rep Power
    0
    Thanks for the reply grim

    You are right, the first time it run slower that the others, but unfortunatly this means that: first time 15sec, the others 7 secs.. I didnt tell you this before.
    My system preserve the .pyc files, but I think that when the CGI program is called maybe the module is re-compiled (little faster 'cause the module was just used before). So what u think i must do?
    Maybe i have to compile and link the cgi module above when compiling the entire python for the system?
    My Python CGI programs are stored in Non-volatile memory, but the .pyc and .py modules are in ramdisk (i think flash then). help me!
  6. #4
  7. Mini me.
    Devshed Novice (500 - 999 posts)

    Join Date
    Nov 2003
    Location
    Cambridge, UK
    Posts
    783
    Rep Power
    13
    I don't think changing Python compile options will help - the CGI module is not going to get any closer to machine code.

    I'm guessing the problem is getting the file out of storage and in to the main system program memory. Does the platform have any facilities for caching the data in system memory? I think this would be an OS option rather than a BOA or Python option.

    Thats my limit on ideas

    grim
  8. #5
  9. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2005
    Posts
    3
    Rep Power
    0
    Thanks again grim,
    dont worry you help me much

    I'll try tu put the module in a faster memory and i'll look for the OS option u tell me.
    I'll post here if I'd find something of heplful
    Thanks a lot,
    bye bye!

    PS: One last thing: the OS and the platform is without MMU, maybe it's this that makes python so slow?

IMN logo majestic logo threadwatch logo seochat tools logo