Here are some benchmark results done with the different versions. All were done
on a 850 Mhz Athlon, with Perl 5.6.0, Linux 2.2.16. 

v0.01 denotes the original Perl 5.6.0 and earlier code of BigInt/BigFloat.
v0.49 is a rewrite attempt by Daniel Pfeiffer as posted on usenet (with some
hacks to make it work).

The string in () after the version denotes the math lib used in BigInt as
detailed below:

   N - None (pre-Calc) C - Calc (pure perl) BV - Bit::Vector P - Math::Pari

The number below the version denotes the size of the base used in v0.49
(automatically determined) and Calc (automatically 1e7, overwritten for 1e5).
If nothing is noted, it is 1e5 for the pure-perl.

Below BV and P stands the version of the package used. If nothing is noted,
this was v1.01. v1.02 of Pari/BitVect were used together with v1.39 of BigInt,
but that should make no difference to v1.37 or v1.38 (since they are essential
the same).

Empty table fields were not measured, mostly because it took to long. If
errors occured, they are noted (Pari stack overflow etc).

###############################################################################
The following calculates n! for 1000:

$n = 1000; factorial ($n);

sub factorial
  {
  my ($n,$i) = shift;
  my $res = Math::BigInt->new(1);
  return $res if $n < 1;
  for ($i = 2; $i <= $n; $i++)
    {
    $res *= $i;
    }
  return $res;
  }

Times for 10 calculations of factorial(n):
 
       Version:
    n:  v0.01|v0.49|v1.33N|v1.36C   BV|v1.37C     C    BV    P|SSLeay::BN
             |  1e7|      |   1e5     |   1e5   1e7           |
  -----------+-----+------+-----------+-----------------------+-----------
   500   10.9|  3.0|   4.8|   5.2  1.8|   4.7   3.7   1.7  1.3|        12
  1000   48.3| 12.8|  19.0|  19.9  4.0|  18.5  14.0   3.7  2.5|        27
  2000  222.0| 55.7|  79.9|  81.7 10.0|  71.2  57.4   9.5  4.9|        40
  3000  524.4|133.1| 189.2| 192.9 18.8| 159.7 123.4  17.8  7.4|
  4000       |247.3|      |           | 270.1 245.2  29.5  9.9|

Note: The values for SSLeay::BN were interpolated (aka guessed) by taking
benchmarks from "Algorithmns in Perl", (page 486 in German version), and than
scaling the numbers to match the speed of v0.01 on this machine. You should
not trust these values too much.

###############################################################################
The following calculates x ** y 10 times:

my $a = shift || 2;
my $b = shift || 2;

for ($i=0; $i<10; $i++)
  {
  $x = Math::BigInt->new($a); $x **= $b;
  }

Times for 10 calculations of 2 ** y:
       
       Version:
          v0.01| v0.49|v1.33N|v1.36C  BV|v1.37C   C    BV      P  BV
      y:       |   1e7|      |          |   1e5 1e7              1.02
 --------------+-----+------+----------+-----------------------------
    1024    0.1|   0.1|   0.2|   0.2 0.1|   0.2   0.2 0.1    0.1  0.1
   10000    5.2|   1.9|   3.8|   3.9 0.1|   3.9   2.1 0.1    0.1  0.1
  100000  505.1| 183.8| 363.3| 368.1 0.1| 364.3 185.5 0.1    0.1  0.1
     1e7       |      |      |          |             0.21   0.3  0.2
     1e8       |      |      |          |             1.14   1)   0.6

Times for 10 calculations of 3 ** y:

       Version:
          v0.01| v0.49|v1.33N|v1.36C    BV|v1.37C     C    BV     P
      y:       |   1e7|      |            |   1e5   1e7           
 --------------+------+------+------------+-------------------------
    1000    0.2|   0.1|   0.3|   0.3   0.1|   0.3   0.1   0.1   0.1
   10000   12.9|   4.8|   9.5|   9.6   2.8|   9.5   4.9   2.8   0.1 
  100000 1279.4| 466.9| 929.8| 933.3 252.0| 920.6 465.1 252.7   0.4
     1e6       |      |      |            |                    10.7    
     1e8       |      |      |            |                     1) 

Times for 10 calculations of 10 ** y:
       
       Version:
          v0.01| v0.49|v1.33N|v1.36C    BV|v1.37C     C   BV      P
      y:       |   1e7|      |            |   1e5   1e7           
 --------------+------+------+------------+-------------------------
    1000    0.7|   0.1|   0.1|   0.6      |   0.2   0.2    0.2   0.1
   10000   56.4|   0.2|   0.1|  41.9      |   0.4   0.3    9.4   0.1
  100000       |   1.3|   0.4|            |   1.7   1.3  891.5   0.8
     1e6       |  13.4|   3.3|            |  16.7  12.1         26.3      
     1e7       | 148.0|  32.9|            |       109.9          1)

Notes: v1.33 had a special case handling for 10 ** y. 10 ** 1e8 can't be done
       due to memory constraints.

Times for 10 calculations of 50 ** y:
       
       Version:
          v0.01| v0.49|v1.33N|v1.36C BV|v1.37C     C     BV     P
      y:       |   1e7|      |         |   1e5   1e7           
 --------------+------+------+---------+--------------------------
    1000    1.8|  24.9|  21.0| 119.8   |  50.0   25.0   27.2   0.1             
   10000  160.6|      |2035.2|         |5161.2 2587.6 2636.6   0.3    
     1e6       |      |      |         |                      68.9    

Notes: v1.3x+ seperate the trailing zeros and thus greatly reduces the
       complexity to (5 ** y) << z, unlike the others which really do 50 ** y.
       Not sure why 0.01 is so fast. 

Times for 10 calculations of 200 ** y:
       
       Version:
          v0.01|v0.49 |v1.33N|v1.36C BV|v1.37C     C     BV     P
      y:       |  1e7 |      |         |   1e5   1e7           
 --------------+------+------+---------+---------------------------
     1e3    3.4|   0.2|   0.2|   2.6   |         0.3    0.6    0.1
     1e4  295.2|  14.7|   4.1| 218.5   |        15.0   40.7    0.2
     1e5       |1517.8| 366.4|         |      1526.4 4169.1    2.5
     1e6       |      |      |         |                       1)       

Notes: v1.3x+ seperate the trailing zeros and thus greatly reduces the
       complexity to (5 ** y) << z, unlike the others which really do 50 ** y. 

Errors: 
 1) stack overflow, stack size limit of 4Mbyte reached

###############################################################################
The following calculates the n'th Fibonacci number (very ineffecively, see
Math::Big for a much faster algorithm):

my $n = shift || 100;

my $x = Math::BigInt->new(1);
my $t; my $y = $x;

$i = 2;
while ($i < $n)
  {
  $t = $x + $y; $x = $y; $y = $t; $i++;
  }

Times for 10 calculations of the above fibonacci(n):
       
       Version:
          v0.01|v0.49 |v1.33N|v1.37C     C     BV      P     P
      n:       |  1e7 |      |   1e5   1e7          1.01  1.02
 --------------+------+------+--------------------------------
    1000    4.9|   0.9|   1.7|   2.1   1.9    2.1   2.2    1.8
    2000   15.6|   2.6|   4.3|   5.0   4.5    4.2   5.0    3.5
   10000  311.4|  51.7|  58.6|  61.9  49.0   20.9  98.1   17.7 
   20000 1245.3| 203.1| 222.4| 216.3 165.8   43.7 602.9   35.9 

###############################################################################
The following calculates $x + $y with length $a for $x and $b for $y:

# generate numbers
$x = Math::BigInt->new('1' . '0' x $a);
$y = Math::BigInt->new('1' . '0' x $b);

for ($i=0; $i<10_000; $i++)
  {
  $x += $y;
  }

Times for 10_000 calculations of $x += $y:
       
	Version:
                    v0.01|v0.49 | v1.39C     C    BV      P
       x:      y:        |  1e7 |    1e5   1e7    1.01   1.01
 ------------------------+------+----------------------------
     1000      10    12.7|   1.5|   1.26   1.23   1.69   1.37
    10000      10   128.2|  11.8|   1.26   1.24   2.96   1.53
   100000      10        | 233.9|   1.29   1.27  95.6    3.6
  1000000      10        |      |   1.83   1.65        238.1
  1000000     100        |      |   2.1    1.8 
  1000000    1000        |      |   5.2    4.0
  1000000   10000        |      |  36.5   26.4 
  1000000  100000        |      | 415.9  297.8
       10     100     4.8|   0.7|   1.5    1.4    1.6    1.36
       10    1000    30.1|   5.0|   4.5    3.6    1.7    1.37
       10   10000        |      |  35.5   25.5    2.9    1.5
       10  100000        |      |                94.9    4.0 

Notes: v0.49 warns a lot about "used uninitialized value in '+' in line 275".
       Remember that $x 10000 and $y 10 means that $x has 10000 digits and
       $y has 10 digits, not that $x == 10000 and $y == 10!
       The numbers are skewed, Pari/BitVect take more time for the new() than
       for the +=, because new() is O(N*N), while += is O(N) or even O(1).

###############################################################################
###############################################################################
Here are the values of a benchmark involving comparing against zero:

#!/usr/bin/perl -w

use Math::BigInt;
use Math::BigFloat;
use Benchmark;

my ($x,$y,$z,$xf,$yf,$zf);

my $digits = shift || 10;
$x = '1'.'0' x $digits;

$x = Math::BigInt->new($x);
$y = -$x;
$z = Math::BigInt->bzero();

$xf = Math::BigFloat->new($x);
$yf = -$xf;
$zf = Math::BigFloat->bzero();

timethese (40000,
  {
  ' 0 <=>  0' => sub { $z->bcmp($z); },			# 1
  ' 0 <=> +x' => sub { $z->bcmp($x); },			# 2	
  '+x <=>  0' => sub { $x->bcmp($z); },			# 3
  ' 0 <=> -x' => sub { $z->bcmp($y); },			# 4
  '-x <=>  0' => sub { $y->bcmp($z); },			# 5

  'f  0 <=>  0' => sub { $zf->bcmp($zf); },		# 6
  'f  0 <=> +x' => sub { $zf->bcmp($xf); },		# 7
  'f +x <=>  0' => sub { $xf->bcmp($zf); },		# 8
  'f  0 <=> -x' => sub { $zf->bcmp($yf); },		# 9
  'f -x <=>  0' => sub { $yf->bcmp($zf); },		# 10
  } );

Values are operations per second, done on 800Mhz Athlon. 

	Version:
                    v0.01|v0.49  | v1.39C      BV      P| v1.40C
   digits:  case:        |  1e7  |    1e7    1.01   1.01|    1e7
 ------------------------+-------+----------------------+-------
       10	1   17467|                              |  18604
       10       2   19230|                              |  18181
       10       3   19047|                              |  18264
       10       4   30075|                              |  37037
       10       5   29629|                              |  35714
       10       6   16393|                              |  16000
       10       7   12738|                              |  15444
       10       8   12658|                              |  15384
       10       9   36697|                              |  36697
       10      10   35714|                              |  35087
     1000	1   17316|                              |  18518
     1000       2   19138|                              |  18264
     1000       3   18779|                              |  18181
     1000       4   29850|                              |  36697
     1000       5   29850|                              |  35398
     1000       6   16260|                              |  15936
     1000       7   12618|                              |  15625
     1000       8   12578|                              |  15384
     1000       9   36697|                              |  36697
     1000      10   35714|                              |  35714

###############################################################################
###############################################################################
Here are some details about a rounding-shoutout. The following script creates
some big semi-random numbers and then rounds them of in 3-some steps:

#!/usr/bin/perl -w
# benchmark to measure rounding speed

# comment one out
use lib '../old'; my $class = 'Math::BigFloat';
#use lib 'lib'; my $class = 'Math::BigInt';

use Math::BigInt;
use Math::BigFloat;

$| = 1;
# for some determined randomness
srand(3);
my $digits = 2000;              # test numbers up to this length
my $loops = 25;                 # so much different numbers (more, better)

for ($i = 0; $i < $loops; $i ++)
  {
  $x = int(rand($digits)+1)+4;                  # length
  $y = "";
  while (length($y) < $x)
    {
    $y .= int(rand(10000));
    }
  $z = length($y);
  $y = $class->new($y);
  print "\r to go ",$loops-$i,"        ";
  # now round some amount to measure it instead of the setup time
  $x = $z-2;                                    # preserve so many digits
  while ($x > 3)
    {
    #$y->fround($x);                            # now round to somewhere
    $y = Math::BigFloat->new($y->fround($x));   # for old lib
    $x -= 3;
    }
  }

###############################################################################
Old v0.01 code:

Total Elapsed Time = 9.001886 Seconds
  User+System Time = 8.941886 Seconds
Exclusive Times
%Time ExclSec CumulS #Calls sec/call Csec/c  Name
 15.1   1.350  1.690  13293   0.0001 0.0001  Math::BigInt::external
 14.3   1.280  1.254  26399   0.0000 0.0000  Math::BigFloat::norm
 13.3   1.190  1.133  57451   0.0000 0.0000  Math::BigInt::bnorm
 10.9   0.979  3.732   4507   0.0002 0.0008  Math::BigInt::badd
 10.2   0.920  0.893  26586   0.0000 0.0000  Math::BigInt::internal
 9.17   0.820  0.802  17588   0.0000 0.0000  Math::BigFloat::stringify
 9.06   0.810  2.572  17613   0.0000 0.0001  Math::BigFloat::fnorm
 5.59   0.500  0.495   4507   0.0001 0.0001  Math::BigInt::add
 4.81   0.430  8.143   8794   0.0000 0.0009  Math::BigFloat::fround
 3.69   0.330  0.321   8786   0.0000 0.0000  Math::BigInt::mul
 3.02   0.270  1.348   8786   0.0000 0.0002  Math::BigInt::bmul
 2.24   0.200  5.658   8786   0.0000 0.0006  Math::BigFloat::round
 1.57   0.140  0.131   8786   0.0000 0.0000  Math::BigInt::cmp
 1.12   0.100  0.806   8819   0.0000 0.0001  Math::BigFloat::new
 0.78   0.070  0.408   8786   0.0000 0.0000  Math::BigInt::bcmp
 0.22   0.020  0.040      3   0.0067 0.0133  main::BEGIN
 0.11   0.010  0.010      1   0.0100 0.0100  Math::BigInt::BEGIN
 0.11   0.010  0.010      2   0.0050 0.0050  lib::BEGIN
 0.00   0.000 -0.000      1   0.0000      -  Config::TIEHASH
 0.00   0.000 -0.000      1   0.0000      -  Config::import
 0.00   0.000 -0.000      6   0.0000      -  Config::FETCH
 0.00   0.000 -0.000      1   0.0000      -  lib::import
 0.00   0.000 -0.000      2   0.0000      -  overload::import
 0.00   0.000 -0.000      2   0.0000      -  overload::OVERLOAD
 0.00   0.000 -0.000      2   0.0000      -  Math::BigInt::import
 0.00   0.000 -0.000      4   0.0000      -  Math::BigFloat::BEGIN
 0.00   0.000 -0.000      3   0.0000      -  Exporter::import
 0.00   0.000 -0.000      1   0.0000      -  warnings::BEGIN
 0.00   0.000 -0.000      1   0.0000      -  warnings::bits
 0.00   0.000 -0.000      1   0.0000      -  warnings::unimport

###############################################################################
New v1.33 code:

Total Elapsed Time = 7.923339 Seconds
  User+System Time = 7.863339 Seconds
Exclusive Times
%Time ExclSec CumulS #Calls sec/call Csec/c  Name
 33.5   2.637  8.367   8794   0.0003 0.0010  Math::BigInt::bround
 25.3   1.990  1.983   4507   0.0004 0.0004  Math::BigInt::add
 12.8   1.010  1.006    918   0.0011 0.0011  Math::BigInt::bstr
 8.77   0.690  0.683   4533   0.0002 0.0002  Math::BigInt::_internal
 8.39   0.660  0.587  31807   0.0000 0.0000  Math::BigInt::objectify
 5.60   0.440  0.433   4533   0.0001 0.0001  Math::BigInt::_split
 4.83   0.380  0.723  17588   0.0000 0.0000  Math::BigInt::digit
 3.82   0.300  0.783  27300   0.0000 0.0000  Math::BigInt::length
 2.54   0.200  0.159  27300   0.0000 0.0000  Math::BigInt::_digits
 2.03   0.160  2.279   4507   0.0000 0.0005  Math::BigInt::badd
 1.78   0.140  0.113  17808   0.0000 0.0000  Math::BigInt::is_zero
 1.78   0.140  1.232   4533   0.0000 0.0003  Math::BigInt::new
 1.53   0.120  0.107   8794   0.0000 0.0000  Math::BigInt::_scale_a
 1.14   0.090  0.027  41765   0.0000 0.0000  Math::BigInt::trace
 0.89   0.070  8.410   8794   0.0000 0.0010  Math::BigInt::fround
 0.38   0.030  0.017   8794   0.0000 0.0000  Math::BigInt::is_nan
 0.38   0.030  1.092    918   0.0000 0.0012  Math::BigInt::_scan_for_nonzero
 0.38   0.030  0.080      3   0.0100 0.0266  main::BEGIN
 0.25   0.020  0.030      5   0.0040 0.0060  Math::BigInt::BEGIN
 0.13   0.010  0.003   4507   0.0000 0.0000  constant::__ANON__
 0.13   0.010  0.010      5   0.0020 0.0020  strict::bits
 0.13   0.010  0.010      1   0.0100 0.0100  vars::BEGIN
 0.13   0.010  0.010      2   0.0050 0.0050  lib::BEGIN
 0.00   0.000 -0.000      3   0.0000      -  Exporter::heavy_export_to_level
 0.00   0.000 -0.000      3   0.0000      -  Exporter::export
 0.00   0.000 -0.000      3   0.0000      -  Exporter::heavy_export
 0.00   0.000  0.010      6   0.0000 0.0017  Math::BigFloat::BEGIN
 0.00   0.000 -0.000      1   0.0000      -  Config::BEGIN
 0.00   0.000 -0.000      1   0.0000      -  Config::TIEHASH
 0.00   0.000 -0.000      1   0.0000      -  Config::import

###############################################################################
###############################################################################
#!/usr/bin/perl -w

#se lib 'lib';
use lib '../old/Math-BigInt-1.46/lib';
#se lib '../old/Math-BigInt-0.01';

use Math::Pari;
use Math::BigInt;
#use Math::BigInt lib => 'Pari';
use Benchmark;

$class = 'Math::BigInt';
#$class = 'Math::Pari';
print "$class v",${$class.'::VERSION'};

if (Math::BigInt->can('_core_lib') && ($class eq 'Math::BigInt'))
  {
  my $lib = Math::BigInt::_core_lib();
  print " lib => ",Math::BigInt::_core_lib();
  $lib = eval "\$$lib\::VERSION";
  print " v$lib";
  }
print "\n";

my $x2 = $class->new(2);
my $x3 = $class->new(3);
my $x150 = $class->new(150);
my $x255 = $class->new(255);
my $x1255 = $class->new(1255);
my $x7 = $class->new(7);
my $x31 = $class->new(31);
my $x777 = $class->new(777);

timethese ( -4,
  {
  'pow_2_31' => sub { $z = $x2 ** $x31; },
  'pow_2_150' => sub { $z = $x2 ** $x150; },
  'pow_3_255' => sub { $z = $x3 ** $x255; },
  'pow_2_255' => sub { $z = $x2 ** $x255; },
  'pow_2_1255' => sub { $z = $x2 ** $x1255; },
  'pow_3_1255' => sub { $z = $x3 ** $x1255; },
  'pow_7_777' => sub { $z = $x7 ** $x777; },
  });

Operations per second, 1Ghz Athlon:

  Math::BigInt	v0.01  v1.46  v1.47  v1.47 Math::Pari
  lib		 n/a    Calc   Calc   Pari    Pari
  version	       v0.14  v0.16  v1.05
 -----------------------------------------------------	
  2**31	 	 758     274   1525   5583   141800
  2**150	 452     192   1039   5570   139800
  2**255	 385     160    850   5572   143300
  3**255	 299     154    691   5378    83100
  2**1255	  96      93    230   5561   137200
  3**1255	  47      68    120   5040    40600
  7**777	  42      66    110   4994    38400
  7**7777	 0.5     1.2    1.2   1021     1268

###############################################################################
###############################################################################

New benchmark showing the improvement in bdec()/binc() and bsub(), both with
Calc and when using different libs. The poor performance for the floating point
inc/dec stems from the fact that BigFloat want's to reduce the numbers and thus
must find out how many trailing zeros there are, and can do so only by
converting the number to dec, which is a O(N*N) operation when using binary
libraries like GMP, BitVect or Pari.

The following script (with some modifications to use the different versions)
was used to generate the data below on a 1 Gz Athlon:

#!/usr/bin/perl -w

$| = 1;

use lib '../old/Math-BigInt-GMP-1.03/lib';
#use lib '../old/Math-BigInt-Pari-1.04/lib';
#use lib '../Math-BigInt-BitVect-1.06/lib';
#use lib '../old/Math-BigInt-BitVect-1.05/lib';
#use lib '../old/Math-BigInt-1.45/lib';
#use lib '../old/Math-BigInt-0.01';
use lib 'lib';

use Math::BigInt lib => 'GMP';
#use Math::BigInt lib => 'BitVect';
#use Math::BigInt lib => 'Pari';
#use Math::BigInt;
use Math::BigFloat;

print "Math::BigInt v$Math::BigInt::VERSION ";
if (Math::BigInt->can('_core_lib'))
  {
  print "lib => ",Math::BigInt->_core_lib();
  my $v = '$'.Math::BigInt->_core_lib().'::VERSION'; $v = eval "$v";
  print " v$v";
  }
print "\n";

use Benchmark;

my $x_10000 = Math::BigInt->new('1'.'0' x 10000);
my $x_1000 = Math::BigInt->new('1'.'0' x 1000);
my $x_100 = Math::BigInt->new('1'.'0' x 100);
my $x_10 = Math::BigInt->new('1'.'0' x 10);
my $x1_10000 = Math::BigInt->new('1'.'0' x 10000);
my $x1_1000 = Math::BigInt->new('1'.'0' x 1000);
my $x1_100 = Math::BigInt->new('1'.'0' x 100);
my $x1_10 = Math::BigInt->new('1'.'0' x 10);
my $y = Math::BigInt->new('1');
my $u = Math::BigInt->new('9'.'9' x 1000);
my $uf = Math::BigInt->new('9'.'9' x 1000);
my $x2_1000 = Math::BigInt->new('1'.'0' x 1000);
my $x3_1000 = Math::BigInt->new('1'.'0' x 1000);

my $xf_10000 = Math::BigFloat->new('1'.('0' x 10000).'1');
my $xf_1000 = Math::BigFloat->new('1'.('0' x 1000).'1');
my $xf_100 = Math::BigFloat->new('1'.('0' x 100).'1');
my $xf_10 = Math::BigFloat->new('1'.('0' x 10).'1');
my $xf2_10000 = Math::BigFloat->new('1'.('0' x 10000).'1');
my $xf2_1000 = Math::BigFloat->new('1'.('0' x 1000).'1');
my $xf2_100 = Math::BigFloat->new('1'.('0' x 100).'1');
my $xf2_10 = Math::BigFloat->new('1'.('0' x 10).'1');

timethese ( -5,
  {
  # comment out the inc tests for v0.01 - it had no binc()/finc() methods  
  binc_10000 => sub { $x1_10000->binc(); },
  binc_1000 => sub { $x1_1000->binc(); },
  binc_100 => sub { $x1_100->binc(); },
  binc_10 => sub { $x1_10->binc(); },
  #finc_10000 => sub { $xf_10000->finc(); },
  finc_1000 => sub { $xf_1000->finc(); },
  finc_100 => sub { $xf_100->finc(); },
  finc_10 => sub { $xf_10->finc(); },
  '++_10000' => sub { ++$x_10000; },
  '++_1000' => sub { ++$x_1000; },
  '++_100' => sub { ++$x_100; },
  '++_10' => sub { ++$x_10; },
  #'f++_10000' => sub { ++$xf2_10000; },
  'f++_1000' => sub { ++$xf2_1000; },
  'f++_100' => sub { ++$xf2_100; },
  'f++_10' => sub { ++$xf2_10; },
  '++_999' => sub { ++$u; },
  'f++_999' => sub { ++$uf; },
  add_1000 => sub { $x2_1000 += $y; },
  sub_1000 => sub { $x3_1000 -= $y; },
  } );

###############################################################################

Output:

Math::BigInt v0.01 
Benchmark: running ++_10, ++_100, ++_1000, ++_10000, ++_999, add_1000, f++_10, f++_100, f++_1000, f++_10000, f++_999, sub_1000, each for at least 5 CPU seconds...
     ++_10:  6 secs ( 5.06 usr +  0.01 sys =  5.07 CPU) @ 5521.30/s (n=27993)
    ++_100:  5 secs ( 5.33 usr +  0.00 sys =  5.33 CPU) @ 3841.28/s (n=20474)
   ++_1000:  5 secs ( 5.21 usr +  0.01 sys =  5.22 CPU) @ 960.92/s (n=5016)
  ++_10000:  5 secs ( 5.22 usr +  0.00 sys =  5.22 CPU) @ 92.91/s (n=485)
    ++_999:  6 secs ( 5.35 usr +  0.00 sys =  5.35 CPU) @ 955.33/s (n=5111)
  add_1000:  5 secs ( 5.23 usr +  0.01 sys =  5.24 CPU) @ 939.89/s (n=4925)
    f++_10:  5 secs ( 5.22 usr +  0.01 sys =  5.23 CPU) @ 3121.03/s (n=16323)
   f++_100:  6 secs ( 5.28 usr +  0.00 sys =  5.28 CPU) @ 2248.11/s (n=11870)
  f++_1000:  6 secs ( 5.37 usr +  0.00 sys =  5.37 CPU) @ 596.28/s (n=3202)
 f++_10000:  5 secs ( 5.27 usr +  0.00 sys =  5.27 CPU) @ 59.96/s (n=316)
   f++_999:  5 secs ( 5.38 usr +  0.00 sys =  5.38 CPU) @ 950.00/s (n=5111)
  sub_1000:  6 secs ( 5.33 usr +  0.01 sys =  5.34 CPU) @ 1038.76/s (n=5547)

Math::BigInt v1.45 lib => Math::BigInt::Calc v0.13
Benchmark: running ++_10, ++_100, ++_1000, ++_10000, ++_999, add_1000, binc_10, binc_100, binc_1000, binc_10000, f++_10, f++_100, f++_1000, f++_10000, f++_999, finc_10, finc_100, finc_1000, finc_10000, sub_1000, each for at least 5 CPU seconds...
     ++_10:  5 secs ( 5.09 usr +  0.01 sys =  5.10 CPU) @ 6027.06/s (n=30738)
    ++_100:  5 secs ( 5.22 usr +  0.00 sys =  5.22 CPU) @ 6000.19/s (n=31321)
   ++_1000:  5 secs ( 5.19 usr +  0.00 sys =  5.19 CPU) @ 6034.87/s (n=31321)
  ++_10000:  5 secs ( 5.31 usr +  0.00 sys =  5.31 CPU) @ 6012.05/s (n=31924)
    ++_999:  6 secs ( 5.33 usr +  0.01 sys =  5.34 CPU) @ 5978.28/s (n=31924)
  add_1000:  5 secs ( 5.22 usr +  0.00 sys =  5.22 CPU) @ 9830.08/s (n=51313)
   binc_10:  6 secs ( 5.17 usr +  0.00 sys =  5.17 CPU) @ 6092.65/s (n=31499)
  binc_100:  5 secs ( 5.18 usr +  0.00 sys =  5.18 CPU) @ 6080.89/s (n=31499)
 binc_1000:  5 secs ( 5.17 usr +  0.00 sys =  5.17 CPU) @ 6090.91/s (n=31490)
binc_10000:  6 secs ( 5.25 usr +  0.01 sys =  5.26 CPU) @ 6095.63/s (n=32063)
    f++_10:  5 secs ( 5.32 usr +  0.01 sys =  5.33 CPU) @ 924.95/s (n=4930)
   f++_100:  5 secs ( 5.22 usr +  0.00 sys =  5.22 CPU) @ 910.34/s (n=4752)
  f++_1000:  5 secs ( 5.17 usr +  0.02 sys =  5.19 CPU) @ 821.97/s (n=4266)
 f++_10000:  5 secs ( 5.28 usr +  0.02 sys =  5.30 CPU) @ 415.28/s (n=2201)
   f++_999:  5 secs ( 5.27 usr +  0.00 sys =  5.27 CPU) @ 5949.34/s (n=31353)
   finc_10:  6 secs ( 5.26 usr +  0.00 sys =  5.26 CPU) @ 919.58/s (n=4837)
  finc_100:  6 secs ( 5.30 usr +  0.01 sys =  5.31 CPU) @ 910.73/s (n=4836)
 finc_1000:  5 secs ( 5.29 usr +  0.00 sys =  5.29 CPU) @ 821.36/s (n=4345)
finc_10000:  5 secs ( 5.12 usr +  0.01 sys =  5.13 CPU) @ 414.81/s (n=2128)
  sub_1000:  4 secs ( 5.22 usr +  0.01 sys =  5.23 CPU) @ 4848.57/s (n=25358)

Math::BigInt v1.45 lib => Math::BigInt::Pari v1.04
Benchmark: running ++_10, ++_100, ++_1000, ++_10000, ++_999, add_1000, binc_10, binc_100, binc_1000, binc_10000, f++_10, f++_100, f++_1000, f++_999, finc_10, finc_100, finc_1000, sub_1000, each for at least 5 CPU seconds...
     ++_10:  5 secs ( 5.25 usr +  0.00 sys =  5.25 CPU) @ 5529.52/s (n=29030)
    ++_100:  6 secs ( 5.33 usr +  0.03 sys =  5.36 CPU) @ 5518.28/s (n=29578)
   ++_1000:  6 secs ( 5.43 usr +  0.05 sys =  5.48 CPU) @ 5297.45/s (n=29030)
  ++_10000:  5 secs ( 5.26 usr +  0.01 sys =  5.27 CPU) @ 5250.47/s (n=27670)
    ++_999:  5 secs ( 5.17 usr +  0.00 sys =  5.17 CPU) @ 5512.96/s (n=28502)
  add_1000:  5 secs ( 5.07 usr +  0.03 sys =  5.10 CPU) @ 9146.67/s (n=46648)
   binc_10:  7 secs ( 5.36 usr +  0.01 sys =  5.37 CPU) @ 5318.81/s (n=28562)
  binc_100:  6 secs ( 5.08 usr +  0.10 sys =  5.18 CPU) @ 5502.32/s (n=28502)
 binc_1000:  5 secs ( 5.18 usr +  0.05 sys =  5.23 CPU) @ 5550.67/s (n=29030)
binc_10000:  5 secs ( 5.20 usr +  0.02 sys =  5.22 CPU) @ 5298.85/s (n=27660)
    f++_10:  5 secs ( 5.26 usr +  0.01 sys =  5.27 CPU) @ 824.48/s (n=4345)
   f++_100:  6 secs ( 5.28 usr +  0.02 sys =  5.30 CPU) @ 549.25/s (n=2911)
  f++_1000:  5 secs ( 5.06 usr +  0.00 sys =  5.06 CPU) @ 16.21/s (n=82)
 f++_10000:  ** did not finish **
   f++_999:  6 secs ( 5.24 usr +  0.01 sys =  5.25 CPU) @ 5529.52/s (n=29030)
   finc_10:  5 secs ( 5.20 usr +  0.03 sys =  5.23 CPU) @ 843.21/s (n=4410)
  finc_100:  5 secs ( 5.24 usr +  0.02 sys =  5.26 CPU) @ 553.42/s (n=2911)
 finc_1000:  5 secs ( 5.39 usr +  0.00 sys =  5.39 CPU) @ 16.14/s (n=87)
finc_10000:  ** did not finish **
  sub_1000:  6 secs ( 5.23 usr +  0.00 sys =  5.23 CPU) @ 4994.84/s (n=26123)

Math::BigInt v1.45 lib => Math::BigInt::BitVect v1.05
Benchmark: running ++_10, ++_100, ++_1000, ++_10000, ++_999, add_1000, binc_10, binc_100, binc_1000, binc_10000, f++_10, f++_100, f++_1000, f++_999, finc_10, finc_100, finc_1000, sub_1000, each for at least 5 CPU seconds...
     ++_10: 14 secs (13.21 usr +  0.35 sys = 13.56 CPU) @ 1390.93/s (n=18861)
    ++_100: 12 secs (12.35 usr +  0.02 sys = 12.37 CPU) @ 1502.67/s (n=18588)
   ++_1000: 13 secs (12.97 usr +  0.02 sys = 12.99 CPU) @ 1473.60/s (n=19142)
  ++_10000: 12 secs (11.77 usr +  0.20 sys = 11.97 CPU) @ 1476.52/s (n=17674)
    ++_999: 13 secs (12.85 usr +  0.38 sys = 13.23 CPU) @ 1425.62/s (n=18861)
  add_1000: 22 secs (21.15 usr +  1.17 sys = 22.32 CPU) @ 911.51/s (n=20345)
   binc_10: 13 secs (13.31 usr +  0.28 sys = 13.59 CPU) @ 1429.87/s (n=19432)
  binc_100: 14 secs (13.16 usr +  0.27 sys = 13.43 CPU) @ 1425.32/s (n=19142)
 binc_1000: 13 secs (13.12 usr +  0.01 sys = 13.13 CPU) @ 1479.97/s (n=19432)
binc_10000: 12 secs (11.66 usr +  0.03 sys = 11.69 CPU) @ 1521.73/s (n=17789)
    f++_10:  5 secs ( 5.26 usr +  0.00 sys =  5.26 CPU) @ 774.33/s (n=4073)
   f++_100:  5 secs ( 5.22 usr +  0.01 sys =  5.23 CPU) @ 260.23/s (n=1361)
  f++_1000:  7 secs ( 7.25 usr +  0.00 sys =  7.25 CPU) @  1.52/s (n=11)
 f++_10000:  ** did not finish **
   f++_999: 14 secs (13.63 usr +  0.40 sys = 14.03 CPU) @ 1374.06/s (n=19278)
   finc_10:  5 secs ( 5.18 usr +  0.01 sys =  5.19 CPU) @ 772.45/s (n=4009)
  finc_100:  6 secs ( 5.30 usr +  0.02 sys =  5.32 CPU) @ 258.65/s (n=1376)
 finc_1000:  7 secs ( 7.42 usr +  0.00 sys =  7.42 CPU) @  1.35/s (n=10)
finc_10000:  ** did not finish **
  sub_1000:  5 secs ( 4.77 usr +  0.35 sys =  5.12 CPU) @ 323.83/s (n=1658)

Math::BigInt v1.45 lib => Math::BigInt::GMP v1.03
Benchmark: running ++_10, ++_100, ++_1000, ++_10000, ++_999, add_1000, binc_10, binc_100, binc_1000, binc_10000, f++_10, f++_100, f++_1000, f++_999, finc_10, finc_100, finc_1000, sub_1000, each for at least 5 CPU seconds...
     ++_10:  6 secs ( 5.09 usr +  0.03 sys =  5.12 CPU) @ 4174.22/s (n=21372)
    ++_100:  5 secs ( 5.26 usr +  0.05 sys =  5.31 CPU) @ 4176.65/s (n=22178)
   ++_1000:  5 secs ( 5.34 usr +  0.02 sys =  5.36 CPU) @ 4139.55/s (n=22188)
  ++_10000:  6 secs ( 5.30 usr +  0.01 sys =  5.31 CPU) @ 4087.19/s (n=21703)
    ++_999:  5 secs ( 5.21 usr +  0.02 sys =  5.23 CPU) @ 4162.14/s (n=21768)
  add_1000:  5 secs ( 5.16 usr +  0.06 sys =  5.22 CPU) @ 6434.87/s (n=33590)
   binc_10:  6 secs ( 5.30 usr +  0.02 sys =  5.32 CPU) @ 4249.06/s (n=22605)
  binc_100:  5 secs ( 5.27 usr +  0.07 sys =  5.34 CPU) @ 4233.15/s (n=22605)
 binc_1000:  5 secs ( 4.96 usr +  0.04 sys =  5.00 CPU) @ 4232.60/s (n=21163)
binc_10000:  5 secs ( 5.14 usr +  0.10 sys =  5.24 CPU) @ 4141.79/s (n=21703)
    f++_10:  5 secs ( 5.17 usr +  0.04 sys =  5.21 CPU) @ 581.96/s (n=3032)
   f++_100:  5 secs ( 5.27 usr +  0.01 sys =  5.28 CPU) @ 426.33/s (n=2251)
  f++_1000:  5 secs ( 5.08 usr +  0.00 sys =  5.08 CPU) @ 16.14/s (n=82)
 f++_10000:  ** did not finish **
   f++_999:  6 secs ( 5.30 usr +  0.06 sys =  5.36 CPU) @ 4137.69/s (n=22178)
   finc_10:  5 secs ( 5.28 usr +  0.01 sys =  5.29 CPU) @ 582.04/s (n=3079)
  finc_100:  5 secs ( 5.15 usr +  0.02 sys =  5.17 CPU) @ 425.73/s (n=2201)
 finc_1000:  5 secs ( 5.43 usr +  0.00 sys =  5.43 CPU) @ 15.65/s (n=85)
finc_10000:  ** did not finish **
  sub_1000:  5 secs ( 5.20 usr +  0.03 sys =  5.23 CPU) @ 3914.72/s (n=20474)

 ***************************** NEW VERSIONS ***********************************

Math::BigInt v1.46 lib => Math::BigInt::Calc v0.14
Benchmark: running ++_10, ++_100, ++_1000, ++_10000, ++_999, add_1000, binc_10, binc_100, binc_1000, binc_10000, f++_10, f++_100, f++_1000, f++_10000, f++_999, finc_10, finc_100, finc_1000, finc_10000, sub_1000, each for at least 5 CPU seconds...
     ++_10:  6 secs ( 5.30 usr +  0.00 sys =  5.30 CPU) @ 21558.11/s (n=114258)
    ++_100:  5 secs ( 5.27 usr +  0.00 sys =  5.27 CPU) @ 21680.83/s (n=114258)
   ++_1000:  4 secs ( 5.26 usr +  0.00 sys =  5.26 CPU) @ 21722.05/s (n=114258)
  ++_10000:  6 secs ( 5.26 usr +  0.01 sys =  5.27 CPU) @ 21680.83/s (n=114258)
    ++_999:  5 secs ( 5.28 usr +  0.00 sys =  5.28 CPU) @ 21639.77/s (n=114258)
  add_1000:  4 secs ( 5.20 usr +  0.00 sys =  5.20 CPU) @ 9690.38/s (n=50390)
   binc_10:  6 secs ( 5.30 usr +  0.01 sys =  5.31 CPU) @ 23158.76/s (n=122973)
  binc_100:  5 secs ( 5.22 usr +  0.01 sys =  5.23 CPU) @ 23060.80/s (n=120608)
 binc_1000:  4 secs ( 5.25 usr +  0.00 sys =  5.25 CPU) @ 22972.95/s (n=120608)
binc_10000:  6 secs ( 5.26 usr +  0.00 sys =  5.26 CPU) @ 22929.28/s (n=120608)
    f++_10:  5 secs ( 5.18 usr +  0.01 sys =  5.19 CPU) @ 4706.36/s (n=24426)
   f++_100:  5 secs ( 5.27 usr +  0.00 sys =  5.27 CPU) @ 4291.27/s (n=22615)
  f++_1000:  6 secs ( 5.34 usr +  0.01 sys =  5.35 CPU) @ 2304.11/s (n=12327)
 f++_10000:  5 secs ( 5.21 usr +  0.00 sys =  5.21 CPU) @ 410.36/s (n=2138)
   f++_999:  6 secs ( 5.21 usr +  0.00 sys =  5.21 CPU) @ 21516.70/s (n=112102)
   finc_10:  5 secs ( 5.21 usr +  0.00 sys =  5.21 CPU) @ 4834.93/s (n=25190)
  finc_100:  5 secs ( 5.29 usr +  0.01 sys =  5.30 CPU) @ 4399.81/s (n=23319)
 finc_1000:  5 secs ( 5.28 usr +  0.00 sys =  5.28 CPU) @ 2334.66/s (n=12327)
finc_10000:  6 secs ( 5.27 usr +  0.00 sys =  5.27 CPU) @ 410.44/s (n=2163)
  sub_1000:  5 secs ( 5.18 usr +  0.00 sys =  5.18 CPU) @ 6191.51/s (n=32072)

Math::BigInt v1.46 lib => Math::BigInt::Pari v1.05
Benchmark: running ++_10, ++_100, ++_1000, ++_10000, ++_999, add_1000, binc_10, binc_100, binc_1000, binc_10000, f++_10, f++_100, f++_1000, f++_999, finc_10, finc_100, finc_1000, sub_1000, each for at least 5 CPU seconds...
     ++_10:  5 secs ( 5.34 usr +  0.00 sys =  5.34 CPU) @ 16016.29/s (n=85527)
    ++_100:  6 secs ( 5.32 usr +  0.05 sys =  5.37 CPU) @ 15924.95/s (n=85517)
   ++_1000:  5 secs ( 5.13 usr +  0.07 sys =  5.20 CPU) @ 15753.65/s (n=81919)
  ++_10000:  6 secs ( 5.17 usr +  0.08 sys =  5.25 CPU) @ 13961.71/s (n=73299)
    ++_999:  5 secs ( 5.14 usr +  0.06 sys =  5.20 CPU) @ 15753.65/s (n=81919)
  add_1000:  5 secs ( 5.17 usr +  0.03 sys =  5.20 CPU) @ 9136.92/s (n=47512)
   binc_10:  4 secs ( 5.22 usr +  0.06 sys =  5.28 CPU) @ 16498.30/s (n=87111)
  binc_100:  5 secs ( 5.10 usr +  0.06 sys =  5.16 CPU) @ 16575.00/s (n=85527)
 binc_1000:  6 secs ( 5.34 usr +  0.05 sys =  5.39 CPU) @ 16161.60/s (n=87111)
binc_10000:  5 secs ( 5.10 usr +  0.05 sys =  5.15 CPU) @ 14232.82/s (n=73299)
    f++_10:  6 secs ( 5.30 usr +  0.03 sys =  5.33 CPU) @ 2994.75/s (n=15962)
   f++_100:  5 secs ( 5.28 usr +  0.01 sys =  5.29 CPU) @ 1507.56/s (n=7975)
  f++_1000:  6 secs ( 5.50 usr +  0.00 sys =  5.50 CPU) @ 30.55/s (n=168)
 f++_10000:  ** did not finish **
   f++_999:  5 secs ( 5.09 usr +  0.08 sys =  5.17 CPU) @ 15551.64/s (n=80402)
   finc_10:  5 secs ( 5.18 usr +  0.01 sys =  5.19 CPU) @ 3032.76/s (n=15740)
  finc_100:  6 secs ( 5.24 usr +  0.01 sys =  5.25 CPU) @ 1519.05/s (n=7975)
 finc_1000:  5 secs ( 5.65 usr +  0.00 sys =  5.65 CPU) @ 30.80/s (n=174)
finc_10000:  ** did not finish **
  sub_1000:  6 secs ( 5.32 usr +  0.01 sys =  5.33 CPU) @ 6489.31/s (n=34588)

Math::BigInt v1.46 lib => Math::BigInt::BitVect v1.06
Benchmark: running ++_10, ++_100, ++_1000, ++_10000, ++_999, add_1000, binc_10, binc_100, binc_1000, binc_10000, f++_10, f++_100, f++_1000, f++_999, finc_10, finc_100, finc_1000, sub_1000, each for at least 5 CPU seconds...
     ++_10:  5 secs ( 5.12 usr +  0.01 sys =  5.13 CPU) @ 20004.48/s (n=102623)
    ++_100:  5 secs ( 5.23 usr +  0.00 sys =  5.23 CPU) @ 19985.28/s (n=104523)
   ++_1000:  6 secs ( 5.31 usr +  0.00 sys =  5.31 CPU) @ 19849.53/s (n=105401)
  ++_10000:  6 secs ( 5.10 usr +  0.00 sys =  5.10 CPU) @ 19975.88/s (n=101877)
    ++_999:  5 secs ( 5.20 usr +  0.00 sys =  5.20 CPU) @ 20102.50/s (n=104533)
  add_1000:  6 secs ( 5.32 usr +  0.00 sys =  5.32 CPU) @ 7419.17/s (n=39470)
   binc_10:  6 secs ( 5.24 usr +  0.01 sys =  5.25 CPU) @ 21352.76/s (n=112102)
  binc_100:  5 secs ( 5.13 usr +  0.01 sys =  5.14 CPU) @ 21405.84/s (n=110026)
 binc_1000:  6 secs ( 5.15 usr +  0.00 sys =  5.15 CPU) @ 21364.27/s (n=110026)
binc_10000:  5 secs ( 5.19 usr +  0.00 sys =  5.19 CPU) @ 21199.61/s (n=110026)
    f++_10:  4 secs ( 5.28 usr +  0.03 sys =  5.31 CPU) @ 2949.15/s (n=15660)
   f++_100:  5 secs ( 5.28 usr +  0.00 sys =  5.28 CPU) @ 840.34/s (n=4437)
  f++_1000:  5 secs ( 5.20 usr +  0.01 sys =  5.21 CPU) @  3.07/s (n=16)
 f++_10000:  ** did not finish **
   f++_999:  6 secs ( 5.25 usr +  0.00 sys =  5.25 CPU) @ 19911.05/s (n=104533)
   finc_10:  5 secs ( 5.26 usr +  0.00 sys =  5.26 CPU) @ 2977.19/s (n=15660)
  finc_100:  5 secs ( 5.30 usr +  0.00 sys =  5.30 CPU) @ 837.17/s (n=4437)
 finc_1000:  6 secs ( 5.34 usr +  0.01 sys =  5.35 CPU) @  3.18/s (n=17)
finc_10000:  ** did not finish **
  sub_1000:  5 secs ( 5.18 usr +  0.00 sys =  5.18 CPU) @ 5502.32/s (n=28502)

Math::BigInt v1.46 lib => Math::BigInt::GMP v1.03
Benchmark: running ++_10, ++_100, ++_1000, ++_10000, ++_999, add_1000, binc_10, binc_100, binc_1000, binc_10000, f++_10, f++_100, f++_1000, f++_999, finc_10, finc_100, finc_1000, sub_1000, each for at least 5 CPU seconds...
     ++_10:  4 secs ( 5.11 usr +  0.02 sys =  5.13 CPU) @ 14035.09/s (n=72000)
    ++_100:  5 secs ( 5.08 usr +  0.03 sys =  5.11 CPU) @ 13840.90/s (n=70727)
   ++_1000:  6 secs ( 5.27 usr +  0.08 sys =  5.35 CPU) @ 13700.75/s (n=73299)
  ++_10000:  5 secs ( 5.28 usr +  0.03 sys =  5.31 CPU) @ 13122.22/s (n=69679)
    ++_999:  4 secs ( 5.27 usr +  0.03 sys =  5.30 CPU) @ 13831.89/s (n=73309)
  add_1000:  5 secs ( 5.27 usr +  0.04 sys =  5.31 CPU) @ 6386.44/s (n=33912)
   binc_10:  4 secs ( 5.23 usr +  0.04 sys =  5.27 CPU) @ 14281.40/s (n=75263)
  binc_100:  5 secs ( 5.18 usr +  0.08 sys =  5.26 CPU) @ 14306.65/s (n=75253)
 binc_1000:  4 secs ( 5.17 usr +  0.05 sys =  5.22 CPU) @ 14301.92/s (n=74656)
binc_10000:  5 secs ( 5.11 usr +  0.05 sys =  5.16 CPU) @ 13505.43/s (n=69688)
    f++_10:  5 secs ( 5.23 usr +  0.02 sys =  5.25 CPU) @ 2151.81/s (n=11297)
   f++_100:  6 secs ( 5.28 usr +  0.02 sys =  5.30 CPU) @ 1253.96/s (n=6646)
  f++_1000:  5 secs ( 5.59 usr +  0.01 sys =  5.60 CPU) @ 30.54/s (n=171)
 f++_10000:  ** did not finish **
   f++_999:  6 secs ( 5.22 usr +  0.03 sys =  5.25 CPU) @ 13782.67/s (n=72359)
   finc_10:  5 secs ( 5.18 usr +  0.06 sys =  5.24 CPU) @ 2155.92/s (n=11297)
  finc_100:  5 secs ( 5.28 usr +  0.01 sys =  5.29 CPU) @ 1258.22/s (n=6656)
 finc_1000:  5 secs ( 5.21 usr +  0.01 sys =  5.22 CPU) @ 30.84/s (n=161)
finc_10000:  ** did not finish **
  sub_1000:  5 secs ( 5.24 usr +  0.03 sys =  5.27 CPU) @ 4781.78/s (n=25200)

###############################################################################

In v1.47, the Calc::_mod() function was finished for the case where $y < $BASE
and $BASE % $y != 0:

##################
#!/usr/bin/perl -w

use lib 'lib';
#use lib '../old/Math-BigInt-0.01';

use Math::Pari;
use Math::BigInt;
#use Math::BigInt lib => 'Pari';
use Benchmark;

$class = 'Math::BigInt';
#$class = 'Math::Pari';
print "$class v",${$class.'::VERSION'};

print " lib => ",Math::BigInt::_core_lib() if Math::BigInt->can('_core_lib')
 && $class eq 'Math::BigInt';
print "\n";

my $x_12345 = $class->new(12345);
my $x_100000 = $class->new('1' . '0' x 100000);
my $x_10000 = $class->new('1' . '0' x 10000);
my $x_1000 = $class->new('1' . '0' x 1000);
my $x_100 = $class->new('1' . '0' x 100);
my $x_20 = $class->new('1' . '0' x 20);
my $three = $class->new(3);
my $onetwothree = $class->new(127);
my $two = $class->new(2);

timethese ( -5,
  {
  mod_12345_3 => sub { $z = $x_12345 % $three; },
  mod_l100000_3 => sub { $z = $x_100000 % $three; },
  mod_l100000_2 => sub { $z = $x_100000 % $two; },
  mod_l100000_123 => sub { $z = $x_100000 % $onetwothree; },
  mod_l10000_3 => sub { $z = $x_10000 % $three; },
  mod_l10000_2 => sub { $z = $x_10000 % $two; },
  mod_l10000_123 => sub { $z = $x_10000 % $onetwothree; },
  mod_l1000_3 => sub { $z = $x_1000 % $three; },
  mod_l1000_2 => sub { $z = $x_1000 % $two; },
  mod_l1000_123 => sub { $z = $x_1000 % $onetwothree; },
  mod_l100_3 => sub { $z = $x_100 % $three; },
  mod_l100_2 => sub { $z = $x_100 % $two; },
  mod_l100_123 => sub { $z = $x_100 % $onetwothree; },
  mod_l20_3 => sub { $z = $x_20 % $three; },
  mod_l20_2 => sub { $z = $x_20 % $two; },
  mod_l20_123 => sub { $z = $x_20 % $onetwothree; },
  not_12345 => sub { $z = ~$x_12345; },
  # for BigInt
  not_l100000 => sub { $x_100000->bnot(); },
  not_l10000 => sub { $x_10000->bnot(); },
  not_l1000 => sub { $x_1000->bnot(); },
  not_l100 => sub { $x_100->bnot(); },
  not_l20 => sub { $x_20->bnot(); }, 
  # for Pari
  pnot_l100000 => sub { $z = ~$x_100000; },
  pnot_l10000 => sub { $z = ~$x_10000; },
  pnot_l1000 => sub { $z = ~$x_1000; },
  pnot_l100 => sub { $z = ~$x_100; },
  pnot_l20 => sub { $z = ~$x_20; }, 
  });
1;

##################

Benchmarks done on a 1Ghz Athlon, values are operations/s rounded to nearest 
integer, factors rounded roughly to integer or to one digit after dot for
factors < 5. lib => Pari case included only for comparisation, since it wasn't
effected by the optimizations in Calc at all. Math::Pari is just for the
curiuos.

                                                              Factor  Factor
  Math::BigInt   0.01    1.46   1.47  1.47  1.47    Pari      1.46=>  0.01=>
  lib             n/a    Calc   Calc  Calc  Pari    n/a       1.47    1.47
  lib version     n/a    0.15   0.16  0.16a 1.05    2.001804
 ---------------------------------------------------------------------------
 mod_12345_3      3945   7731   7571  6761  7315    155800             1.9
 mod_l20_123      2724   3923   6587  6162  7020    138900    1.7      2.4
 mod_l20_2        3000   7490   7425  6689  7299    155100             2.5
 mod_l20_3        2735   3915   6737  6289  6993    136640    1.7      2.5
 mod_l100_123     1194   2006   5128  6162  6993    129990    2.5      4.3
 mod_l100_2       1597   7020   6953  6684  7271    146520             4.3
 mod_l100_3       1208   1985   5512  5748  6980    131080    2.7      4.6
 mod_l1000_123     165    320   1545  2283  6768     84800    4.8      9
 mod_l1000_2       255   4273   4310  6655  7034     91550            17
 mod_l1000_3       167    319   1926  3022  6775     84970    6.0     11
 mod_l10000_123     17     33    187   337  5199     18690    5.6     11
 mod_l10000_3       17     33    238   523  5170     18650    7.2     14 
 mod_l10000_2       26    845    890  6707  5338     18990            34
 mod_l100000_123   1.6    3.2     16    33  1510      2100    5.0     10
 mod_l100000_2     2.4     60     60  6705  1530      2110            25
 mod_l100000_3     1.6    3.2     20    51  1510      2100    6.2     12

 not_12345	  6340	        9793        8320       n/a
 not_l20	  5550		9867        8265       n/a
 not_l100	  4005		9914        8320       n/a
 not_l1000	   966		9909        8214       n/a
 not_l10000	    92		9817        7664       n/a
 not_l100000	     7		9990        4251       n/a
 pnot_12345	  6340	        6816        6372    116307
 pnot_l20	  5550		7470        6365    117421
 pnot_l100	  4005		6520        5927    115567
 pnot_l1000	   966		4292        5872    101474
 pnot_l10000	    92		 741        5495     48655
 pnot_l100000	     7		  61        2562      6742

As you can see, going via Math::BigInt imposes quite a big constant overhead
compared to using Math::Pari directly, although the overhead is constant and
per operation, not dependend on data length.

About 7500 operations per second is the maximum you get due to all the trips
trough the overloaded code, the OO checks and the multiply subroutines calls
(and all that in Perl, too). 

Calc could win if the numbers start to grow, but currently the slow copy() of
the array makes it loose. Calc v0.16a is a version which implements 'cow'
(copy-one-write) to overcome this.

Unfortunately, there is even more constant overhead - even though this version
is quite heavily optimized and only has a very small overhead compared to my
first version with cow.

The reason why v1.47 doesn't have this as default is because it slows down the
testsuite from 11.5 to 13.5 seconds, which is unaccepatble (at least for me).

As you can see from the numbers, for some operations cow can really help, but
these are only overloaded operations that you could write as $x %= $y and
achive the same effect. So I am not sure whether this is really usefull.

Basically cow saves you only time if there is a lot of data copying going on
and the actual math takes much less time than the copy. It also works only for
Calc, since that has the slow array cop, while Pari et al. sport a very fast
memcopy.
