_mp_alloc vs ALLOC

Niels Möller nisse at lysator.liu.se
Fri Feb 24 10:27:17 CET 2012


Torbjorn Granlund <tg at gmplib.org> writes:

> I think the conclusion is that TMP_ALLOC_LIMBS_2 could save some cycles
> by collapsing two malloc calls into one, when allocating large blocks
> using TMP_ALLOC (as opposed to TMP_BALLOC or TMP_SALLOC).

What about the test in

#define TMP_ALLOC(n) \
   (LIKELY ((n) < 65536) ? TMP_SALLOC(n) : TMP_BALLOC(n))

That test will cost a cycle or two for each TMP_ALLOC call (with
non-constant n), regardless of size, won't it?

Regards,
/Niels

-- 
Niels Möller. PGP-encrypted email is preferred. Keyid C0B98E26.
Internet email is subject to wholesale government surveillance.


More information about the gmp-devel mailing list