Next Making Programs Faster 120

Numerical Calculation

      BTW It seems that using Math::BigFloat methods directly is
      slighly faster then relying on overloaded operations:

        timethese(1000, {
           Methods => sub { Math::BigFloat->new(100)->fmul(Math::BigFloat->new(100)) },
           Operations => sub { Math::BigFloat->new(100) * Math::BigFloat->new(100) },
       });

      Benchmark: timing 1000 iterations of Methods, Operations...
         Methods:  2 wallclock secs 
         ( 1.48 usr +  0.01 sys =  1.49 CPU) 
         @ 671.14/s (n=1000)
         Operations:  1 wallclock secs 
         ( 1.63 usr +  0.00 sys =  1.63 CPU) 
         @ 613.50/s (n=1000)
        Moreover using subroutine calls should be even more
        faster. That is use Math::BigFloat::OP($num) instead of
               $num->OP.

Next Copyright © 2003 M. J. Dominus