Making Python run fast on a slow machine?

Jonathan Ellis jonathan at carnageblender.com
Tue Nov 22 13:55:28 MST 2005


On Tue, 22 Nov 2005 13:19:05 -0700 (MST), "Dave Smith"
<DavidSmith at byu.net> said:
> I've got a sub-100MHz Linux machine on which I am running some Python
> applications. Python's great, but at 100MHz it feels like Java at 1.0GHz.
> It takes about 1 second just to start up the interpreter, and about
> another half second to read the system uptime, read a bit from a
> localhost
> socket, and print out some HTML. I would rather this took 0 seconds. I've
> tried compiling my script into byte code with py_compile and -O, but it
> only saved me about 0.1 seconds. I'm using Python version 2.4 on a 2.4.26
> kernel on a PowerPC if you must know. Any ideas to speed up the snake? I
> think the Python code is good because my 2.4GHz machine runs it without
> any observable delay.

Hmm, 1s sounds slow for interpreter startup, even at 100MHz.  Are you
sure you're not swapping?

If you're not, pseudo-Python native code generators like Pyrex and
Shedskin are probably your only hope.  Or perhaps a less-demanding
language entirely.  (Lua, perhaps?)

-Jonathan
-- 
C++ is history repeated as tragedy. Java is history repeated as farce.  --Scott McKay




More information about the PLUG mailing list