possible speedup for mpz_nextprime_small

Marco Bodrato bodrato at mail.dm.unipi.it
Thu Mar 26 14:20:34 UTC 2020


Ciao,

Il 2020-03-26 01:06 Seth Troisi ha scritto:
> Marco was interested in what using dynamically allocating primes would
> look like.
> I've attached a couple of screenshots.

I'd like to understand the reason why the line "dynamic" is 5-10% lower 
than the other lines in the range above 27...

> I think a good balance would be to add 70 primes and increase
> SMALL_LIMIT to 1,000,000

Adding back the primes we just removed, because they are useful again!

> We would need a new constant to differentiate
> if (nbits / 2 < NUMBER_OF_PRIMES)
>   and
> ASSERT (i < NUMBER_OF_PRIMES);

Yes. The first is a threshold to switch from a method to another. Should 
it be tuned on different CPUs?
NUMBER_OF_PRIMES is the hard limit for that threshold.

Ĝis,
m


More information about the gmp-devel mailing list