speeding up Python

Dave Brueck dave at pythonapocrypha.com
Tue May 17 20:41:56 EDT 2005


Luis P. Mendes wrote:
> I have a 1000 line python script that takes many hours to finish.  It is 
> running with six inside 'for' loops.

Hi Luis,

Before going too much into optimizing your current code, you might want to take 
a step back and see if another approach to your problem might work instead. 
Python is great for this sort of algorithmic experimentation.

So: what are you doing? In particular, why SIX nested loops?

It's not uncommon for a different algorithm to yield performance improvements 
that are orders of magnitude greater than what just optimizing the code could 
achieve.

-Dave



More information about the Python-list mailing list