Python executables?

Roy Smith roy at panix.com
Fri Jun 27 00:11:33 EDT 2003


W Isaac Carroll <icarroll at pobox.com> wrote:
> When choosing between programming languages there is little correlation 
> between size of code and speed of execution. However, within a given 
> language size and speed are usually opposing considerations. For 
> example, to speed up a loop you often unroll it thus decreasing 
> execution time at the expense of increasing code size.

With the kinds of I-cache architectures common today, you can get some 
unexpected effects.  It's possible that the increase in code size from 
unrolling a loop blows your cache and ends up running slower.  If you 
ever get to the point where you're worrying about loop unrolling, you'd 
better really understand the hardware you're running on, and do a lot of 
benchmarking to make sure you're getting the improvement you expect.  
Benchmarking non-deterministic things like cache behavior is an 
adventure in itself.

My general philosophy these days is to write it how it makes sense and 
let the compiler take care of the optimizing.  But then again, I don't 
do the kind of stuff where grubbing a CPU cycle here or there makes a 
difference.




More information about the Python-list mailing list