Interesting timing issue I noticed

Jonathan Shao jzshao1 at gmail.com
Wed Apr 16 09:36:14 EDT 2008


*Gabriel Genellina* gagsl-py2 at yahoo.com.ar
<python-list%40python.org?Subject=Interesting%20timing%20issue%20I%20noticed&In-Reply-To=>
*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: <http://mail.python.org/pipermail/python-list/attachments/20080416/654e6109/attachment-0001.html>


More information about the Python-list mailing list