speeding up Python script

Grant Edwards grante at visi.com
Wed May 18 15:25:25 EDT 2005


On 2005-05-18, Luis P. Mendes <luis_lupe2XXX at netvisaoXXX.pt> wrote:

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

[...]

> How can I dramatically improve speed?

In probably order of efficacy:

 1) Use a better algorithm

 2) Replace 'for' loops with vector operations or list
    comprehensions

 3) Install more RAM

 4) Install a faster disk drive
 
 5) Use a faster CPU

 6) Rent DVDs to watch while program is running. 

Before you do anything, you should profile your program to see
where the time is being spent.
 
-- 
Grant Edwards                   grante             Yow!  Hand me a pair of
                                  at               leather pants and a CASIO
                               visi.com            keyboard -- I'm living
                                                   for today!



More information about the Python-list mailing list