[seqfan] Re: As much as I hate "base" sequences...

hv at crypt.org hv at crypt.org
Wed Jan 22 20:44:14 CET 2014


"David Wilson" <davidwwilson at comcast.net> wrote:
:I don't have a real arbitrary precision arithmetic package, so I am using
:ActivePerl Math::Bignum, which is somewhat slow.

Math::Bignum is pretty awful speed-wise for anything intensive. Math::Pari
and Math::GMP are both a great deal faster, if either of those is available
to you.

I've recently been making speed improvements to Math::GMP, reducing
the perl overhead of operations by about 3x so far (which gets it closer
to Math::Pari speed), but that's unlikely to reach a release for at least
a couple of months; if you're in a position to compile it yourself,
I'd be happy to make it available somewhere earlier.

If they are not available to you (because you don't have a compiler,
and ActiveState doesn't build them), I might be able to encourage them
to provide a build - I know several of the core perl developers that
work there, and nearly became one myself a number of years ago.

Here's a benchmark I did recently for C<< die unless ($a % $b) == 3 >>
where $a == 3, $b == 5 and both variables are:
  bb => Math::BigInt
  gg => Math::GMP
  hh => my improved Math::GMP
  pp => Math::Pari
  ss => simple perl scalar

        Rate      bb      gg      hh      pp      ss
bb    8967/s      --    -84%    -93%    -97%   -100%
gg   54612/s    509%      --    -59%    -82%    -99%
hh  132741/s   1380%    143%      --    -57%    -99%
pp  309688/s   3354%    467%    133%      --    -97%
ss 9410297/s 104844%  17131%   6989%   2939%      --

Hugo



More information about the SeqFan mailing list