Boost logo

Boost :

From: Guillaume Melquiond (guillaume.melquiond_at_[hidden])
Date: 2005-03-06 03:46:36

Le samedi 05 mars 2005 à 22:24 -0500, Jody Hagins a écrit :
> On Sun, 06 Mar 2005 01:33:50 +0100
> Guillaume Melquiond <guillaume.melquiond_at_[hidden]> wrote:
> > I can't tell you what it would be for this particular implementation,
> > but I can give you some results I got when using GMP some times ago. I
> > hope everybody will agree that GMP is a high quality implementation of
> > big integers, and hence the results are relevant.
> Hmmm. Did you try the C++ wrappers, which are already implemented with
> expression templates?

The tests were purely C tests, so they weren't using the C++ wrappers.

But I have also used GMP C++ wrappers in other occasions, and I know
they are able to remove the last temporary before assignation. So the
results in C++ would have been similar for single arithmetic operations:
the ET addition would have been 6 times faster than the dumb addition,
and the ET multiplication would have been 2 times faster than the dumb

The GMP C++ wrappers do not reuse the temporaries though, so the more
complex expressions would benefit from C hand-writing. For example, in
the expression "a*b + c*d + e*f", the temporary needed to computed "c*d"
won't be reused later to compute "e*f.

I'm not even sure such optimizations can be done by strictly using C++
meta-programming though. It seems to me some kind of language support
would be required. But maybe I'm overly pessimistic and a complex ET
implementation would be able to reuse temporaries.

Best regards,


Boost list run by bdawes at, gregod at, cpdaniel at, john at