in reply to Re^4: code optimization
in thread code optimization
I tried the following test for division.
I did the same thing for multiplication. On a couple of runs for division I got the times: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"'
- 1.032998
- 1.029043
- 1.043523
- 1.059354
- 1.034561
- 1.072301
- 1.10864
- 1.034843
- 1.075402
- 1.093403
- 1.089273
- 1.077661
- 1.074203
- 1.091646
- 1.080421
These numbers are seconds.
I couldn't draw any conclusions from this...
In Section
Seekers of Perl Wisdom