GMP versus TFM on an AMD64



For all those who were trying to insult me about how much GMP was
faster...

:-) ^_^ grin ^_^

This is on an Opteron 275 running the latest GMP and my newly crafted
GMP plugin for LTC (basically calls mpz_powm).

GMP:
RSA-1024 encrypt_key took 121194 cycles
RSA-1024 decrypt_key took 1845297 cycles
RSA-1280 encrypt_key took 169824 cycles
RSA-1280 decrypt_key took 3278677 cycles
RSA-1536 encrypt_key took 229255 cycles
RSA-1536 decrypt_key took 5317780 cycles
RSA-1792 encrypt_key took 301444 cycles
RSA-1792 decrypt_key took 8069089 cycles
RSA-2048 encrypt_key took 384635 cycles
RSA-2048 decrypt_key took 11513466 cycles

Compare to TFM:
RSA-1024 encrypt_key took 178994 cycles
RSA-1024 decrypt_key took 1376474 cycles
RSA-1280 encrypt_key took 285829 cycles
RSA-1280 decrypt_key took 2228425 cycles
RSA-1536 encrypt_key took 337265 cycles
RSA-1536 decrypt_key took 3488658 cycles
RSA-1792 encrypt_key took 398694 cycles
RSA-1792 decrypt_key took 5109385 cycles
RSA-2048 encrypt_key took 464253 cycles
RSA-2048 decrypt_key took 6981056 cycles

For the smaller sizes GMP does better mostly because I setup more k-ary
table than I should. But on the decrypt side TFM clearly wins.

I don't have ECC timings yet [I have ECC working though] as GMP seems
to lack a publicly exported reduction function. I'll craft one doing
whole number montgomery reduction. Right now I'm using mpz_mod and it
makes it between 2x and 3x slower than TFM. I won't list them since I
acknowledge that isn't a fair fight.

Roughly speaking both shared objects [for GMP and TFM] are about the
same size. Though GMP does some odder things TFM doesn't. That said
for crypto purposes I don't see the draw for GMP. It's clearly not
faster than TFM, at least on my AMD64 box.

Tom

.