Interesting timing issue I noticed

Jonathan Shao jzshao1 at
Wed Apr 16 15:36:14 CEST 2008

*Gabriel Genellina* gagsl-py2 at
*Wed Apr 16 08:44:10 CEST 2008*
> Another thing would be to rearrange the loops so the outer one executes
less times; if you know that borderX<<sizeX and borderY<<sizeY it may be
better to swap the inner and outer loops above.
Thank you for the tip on xrange.
Even if I swap the inner and outer loops, I would still be doing the same
number of computations, am I right (since I still need to go through the
same number of elements)? I'm not seeing how a loop swap would lead to fewer
computations, since I still need to calculate the outer rim of elements in
the array (defined by borderX and borderY).

~ Jon

"Perhaps we all give the best of our hearts uncritically, to those who
hardly think about us in return."
~ T.H.White
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the Python-list mailing list