Re: mpz_prevprime

2020-03-06 Thread Seth Troisi
Some more justification for my patch I wrote some code that replaces mpz_millerrabin with a static lookup and ran it for a number of values. Existing Code (with real mpz_millerrabin) 100, gap: 1533, 0.00164 seconds 200, gap: 2547, 0.00675 seconds 300, gap: 3757, 0.01161 seconds 500, gap: 3765, 0.

Re: mpz_prevprime

2020-03-06 Thread Seth Troisi
I tried using a segmented sieve. this avoids multiplication or mod in the inner loop. It's an improvement and the code is easy to comprehend. $ ./tune/speed -s 100-300,500,1000 -f 1.1 mpz_nextprime -p mpz_nextprime $ hg import ~/Downloads/nextprime_segment.patch --no-commit $ make -j4; make -C tun

[PATCH] mini-gmp: pass correct old_size to custom reallocate function

2020-03-06 Thread minux
Hi, mini-gmp currently always passes old_size == 0 to the custom reallocate function, causing custom allocators for GMP that use old_size to determine the amount of data to copy data to newly allocated space to malfunction with mini-gmp. According to GMP documentation chapter 13 for reallocate_fu