Python is slow

RPM1 rpm9deleteme at earthlink.net
Thu May 22 21:35:10 EDT 2008


Larry Bates wrote:
> If your Python program is 
> slow, you have almost assuredly approached it with a wrong method or 
> algorithm.

I agree for most applications.  There are however times where Python 
just isn't fast enough, and that's usually when people write extension 
modules.

I have yet to see a chess engine written in Python that is competitive 
with even a below average C or C++ chess engine.  The same could be said 
of Java, VB, C#, Pearl, ...

So there ARE some tasks that Python just isn't suited for due to 
performance, but not enough for it to steer anyone away from Python.

I have been working on a chess engine and have found that I prototype in 
Python and then port to the D programming language, (which IS fast). 
For example, one of my routines, (generating pseudo-legal moves -- no 
evaluation), in Python runs at 700,000 moves per second, (using Psyco). 
  Ported to D it runs at 22 million moves per second.

Python's advantage is in the software development and maintenance 
phases.  As long as the runtime phase is fast ENOUGH, Python kicks most 
other languages butts.

Patrick





More information about the Python-list mailing list