in reply to Very basic question on performance

If the aim is really to compute:

sub diag { my $x = shift @_; my $y = shift @_; my $x_sq = $x * $x; my $y_sq = $y * $y; my $prod = $x_sq * $y_sq; my $result = sqrt($prod); return $result; }
then it will be presumably much faster to calculate it this way:
sub diag { my $x = shift @_; my $y = shift @_; return abs ($x * $y); }
or this way:
sub diag { return abs ($_[0] * $_[1]); }

Update: I've just corrected the code above adding the abs function which I had omitted, since my original function would have returned a negative number if one of the arguments were negative. Thanks to clueless newbie and davido who pointed that to me.