GMP Module (perl)
Sat, 26 Jul 2003 12:26:47 +1000
----- Original Message -----
From: "Kevin Ryde" <firstname.lastname@example.org>
> The asm routines are the most important thing for speed in gmp. After
> that we usually recommend gcc, since it gets various inline asm
> blocks. The generated perl stuff is pretty straightfoward and
> unlikely to be affected one way or the other.
Yes, I've (now) compared both. The gcc-built version runs a little quicker,
but the difference is barely measurable and insignificant. (5.02 seconds
versus 5.03 seconds for the tests that I ran.)
> > g++ didn't like having a variable named 'class'
> Ah yes, I might change that.
Good idea. You might also mention in the installation notes that gcc-users
should run the first step as 'perl Makefile.PL CC=g++'.
> > It's nicer, imo, to use
> > than Math::GMP, and additionally provides access to a greater range of
> > functions.
> More functions was the aim.
It's nicer, too. Sorry .... I can't do anything about that ....you'll just
have to live with it :-)
Main thing I like is that I don't have to code all that 'Math::GMP->new()'
stuff. Also I can pass a GMP object directly to my own XS functions (which
simply take strings as arguments). When I pass a Math::GMP object I have to
remember to interpolate it. Your module's documentation, being in effect the
GMP documentation, is excellent. Math::GMP doesn't seem to document all of
And I find your perl function names easier to remember.
So, don't get too carried away .... it's not 'phenominally nicer' .... just
nicer (for me) in small ways :-)
> > Have you considered placing it on cpan ?
> It was easier to get started just chucking it in the gmp sources. I
> suppose at least a cross reference in cpan would be nice.
I guess I'm just thinking that it would be noticed more if it were
accessible via cpan - and it's something worthy of more attention than it's
probably getting at the moment.
> I hadn't wanted to worry about being Math::BigInt compatible, so did
> something new. I think BigInt was a bit bare when I'd first looked at
> it too. Seems to have grown since then, might be the way to go for
> the future.
Yes, Math::BigInt is getting better - though it will always be unbelievably
slow. It does provide access to the important mpz() functions courtesy of
Math::BigInt::GMP (which now comes with its own XS code and no longer relies
But, afaik, there's currently no modules on cpan that access the mpf() and
mpq() functions. (Haven't looked at what Math::Pari provides. I'm personally
interested pretty much solely in the integer functions.)