At 16:48 27/03/2001 +0100, Simon Wilcox wrote:
>Benchmark: timing 100000 iterations of Array, Sub, myArray...
> Array: 3 wallclock secs ( 3.37 usr + 0.05 sys = 3.42 CPU)
> Sub: 6 wallclock secs ( 5.30 usr + 0.08 sys = 5.38 CPU)
> myArray: 8 wallclock secs ( 8.39 usr + 0.11 sys = 8.50 CPU)
And just to be fair & complete, I've pre-computed the array for the sub:
[snip]
@th2=(qw(th st nd rd),("th")x6);
sub th2{(($_[0]-10-$_[0]%10)/10%10)?$th2[$_[0]%10]:"th"}
[snip]
'preSub' => '{
my @time=localtime;
my $th=th2($time[3]);
my $dummy = strftime("%e$th %b %Y\n", @time);
}'
And get :
Benchmark: timing 100000 iterations of Array, Sub, myArray, preSub...
Array: 4 wallclock secs ( 3.35 usr + 0.07 sys = 3.42 CPU)
Sub: 6 wallclock secs ( 5.24 usr + 0.11 sys = 5.35 CPU)
myArray: 8 wallclock secs ( 8.51 usr + 0.11 sys = 8.62 CPU)
preSub: 5 wallclock secs ( 4.43 usr + 0.10 sys = 4.53 CPU)
Thanks folks, that little interlude saved me from throwing my PC out the
window as Visio 2000 crashed for the 6th time today !
Simon