http://www.perlmonks.org?node_id=935942


in reply to Re^4: code optimization
in thread code optimization

I tried the following test for division.
perl -MTime::HiRes=gettimeofday,tv_interval -e '$istart=1000;$iend=500 +0; $t0=[gettimeofday]; for $x($istart..$iend){for $y($istart..$iend) +{ $x/$y }}; $t1=[gettimeofday]; print "lasted->".tv_interval($t0,$t1) +."\n"'
I did the same thing for multiplication. On a couple of runs for division I got the times: On a couple of runs for multiplication I got the times:

These numbers are seconds.

I couldn't draw any conclusions from this...