mpn_mul is embarrassingly slow

Niels Möller nisse at
Wed Apr 25 11:34:44 UTC 2018

tg at (Torbjörn Granlund) writes:

> More embarrassments.  :-)
> I ran some timing tests without my proposed change and with the squqring
> exception code still there.  Please consider the following two
> measurements for doing n x 19 limb (first table) and n x 20 limb
> multiplication.
> MUL_TOOM22_THREASHLD is 20 for this machine (compiled in, but also
> measured now).  My comments below.

For n x 20, n pretty large, what strategy does mpn_mul use? I would
expect repeated toom32, but maybe that gives too much overhed. It seems
we don't have any MUL_TOOM32_TO_BASECASE threshold?


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

More information about the gmp-devel mailing list