[RFC][PATCH] mini-gmp: move memory allocation out of loops

Marco Bodrato bodrato at mail.dm.unipi.it
Sat Feb 10 11:25:53 UTC 2018


Ciao,

Il Sab, 10 Febbraio 2018 10:41 am, Niels Möller ha scritto:
> "Marco Bodrato" <bodrato at mail.dm.unipi.it> writes:
>
>> Il Mar, 6 Febbraio 2018 7:21 pm, Ilya Yanok ha scritto:
>>> I did a small patch for mini-gmp, that removes memory allocations in

>> Modify mpn_div_qr_1_preinv to work in-place, whenever the funcion is
>> called to overwrite its input anyway.

> Hmm, but except if qp == NULL, can't we *always* reuse the qp area for the
> shifted input? Something like (untested):

Your proposal is better than mine, agreed.

> I also note that we have a very similar allocation in
> mpn_div_qr_2_preinv.

Currently it is used just once in the whole mini-library, by the call:
mpn_div_qr_2_preinv (qp, np, np, nn, inv);

i.e. values in np get overwritten to store the reminder. If we take this
single use into account, we can always shift inplace...

Ĝis,
m

-- 
http://bodrato.it/



More information about the gmp-devel mailing list