speed of mpz_odd_p and lazy allocation
Torbjorn Granlund
tg at gmplib.org
Tue Aug 14 16:44:41 CEST 2012
I think we should think twice before changing GMP's trickery about
expecting a one-limb alloation always. This type of streamlining in GMP
saves many cycles when computing with small bignums. I'd rather do more
micro-optimisation than less!
I think it might nevertheless be possible to allow lazy allocation using
some trickery. Perhaps custom allocators could _mp_d could point to a
common scratch limb, for this situation? This should create no problems
inside GMP, such as with threading, as read _mp_d[0] will never be
depended upon.
--
Torbjörn
More information about the gmp-devel
mailing list