On Wed, Nov 16, 2005 at 05:17:29AM -0800 John W. Krahn wrote:
 
> The first one should be faster.  Of course you could use the Benchmark module
> to find out for sure.

Thanks for your help.
 
I tried Benchmark but the results seem not reliable:

cmpthese( -5, { a => sub{$x*$x}, b => sub{$x**2} } );

outputs:
       Rate    b    a
b 3858660/s   -- -19%
a 4757428/s  23%   --


cmpthese( -5, { a => sub{$x**2}, b => sub{$x*$x} } );

outputs:
       Rate    b    a
b 4401295/s   -- -14%
a 5141629/s  17%   --

perhaps I missed something ?

-- 
Gérard


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to