mpn_mul is embarrassingly slow

Victor Shoup shoup at cs.nyu.edu
Tue Apr 24 12:34:38 UTC 2018


I'm not sure that's a great idea from a backward 
compatibility point of view.

Also: when exactly was mpn_sqr added to the public interface?
That's something I'll have to take into account in writing GMP client code.


> On Apr 24, 2018, at 8:11 AM, paul zimmermann <Paul.Zimmermann at inria.fr> wrote:
> 
>       Dear Torbjörn,
> 
>> What do you think about this stopgap change?
> 
> I would entirely drop all the squaring-related stuff from mpn_mul:
> the user/developer should call mpn_sqr instead (see my previous mail).
> 
> Then the code would become:
> 
>   if (BELOW_THRESHOLD (vn, MUL_TOOM22_THRESHOLD))
>     {
>       mpn_mul_basecase (prodp, up, un, vp, vn);
>       return prodp[un + vn - 1];	/* historic */
>     }
> 
>   if (un == vn)
>       return mpn_mul_n (prodp, up, vp, un);
> 
>   ...
> 
> (I believe it is vn and not un that should be compared to MUL_TOOM22_THRESHOLD.)
> 
> Paul
> _______________________________________________
> gmp-devel mailing list
> gmp-devel at gmplib.org
> https://gmplib.org/mailman/listinfo/gmp-devel



More information about the gmp-devel mailing list