Why set zero in zero.c rather than use xor_n
tg at gmplib.org
Mon Feb 5 19:58:07 UTC 2018
Vincent Lefevre <vincent at vinc17.net> writes:
Your test is wrong because after one iteration, the data will be
in the cache. I mean that the first call may be much slower than
the subsequent calls. And in practice, mpn_zero will be just
called once on a given object. So only the first call matters.
Moreover "rp[i] = 0;" does not need to read data, which is better
for the cache. Testing on real applications would give more
The iteration count presumably hides the initial cache effects.
But comparing function A and B for a single small operand size tells us
Now it is true that mpn_zero runs far from optimally, since it is
written in C, although typically inlined. I am not sure it is important
enough to write in asm, though.
Please encrypt, key id 0xC8601622
More information about the gmp-devel