Next n-1 optimization got me an 11% gain. In scanriecoin.c's init funtion change memset and start looping @ 1 (note I've other optimizaitons which might have "confused" this code section so no complaints).
// Just memset odd/even and be done
memset( pSieve, 0xAA, opt_sieve_size/8 );
// We set odd primes in the memset ;-) so start @ 2nd prime (3)
for(unsigned int primeIndex = 1 ; primeIndex < primeTableSize; primeIndex++ ) {
We can do this as the base is always an even number so no point looping to bit set every second bit. Also there is a slight variance as the original code never marked the 1st bit as composite (doesn'tmake much of a difference, but did cause me concern until I spent some quality time in gdb.
Off to work, enjoy.
--
bsunau7
For others: Be very careful when doing this. You need to take steps to *ensure* that the base is always even -- changes elsewhere in code can render this assumption false. I ran into this the hard way.
The real risk here is that you *won't know that you screwed up* unless you've applied my length-reporting patch. The kh/s numbers will go up if you apply this change wrong, and it will look great, but it will look good because it's reporting all sorts of crap that then get counted in kh/s but filtered out by the rabin-miller tests.
Ahem, giving away my secret sauce a bit, you can easily ensure that the base is something you want by unconditionally mpz_set'ting or clearing, as you need for your other tweaks, the last bit of 'b' before the call to init().
Apply the length outputting patch and then test bsunau7's suggestion. It will make things faster if it works right.
-Dave