My optimization centers around the Primorial and the loop that occurs in main.cpp on line 4622.
Flat profile:
Each sample counts as 0.01 seconds.
% cumulative self self total
time seconds seconds calls ms/call ms/call name
79.89 45.84 45.84 5698 8.04 8.04 CSieveOfEratosthenes::Weave()
10.28 51.74 5.90 5694 1.04 1.04 CSieveOfEratosthenes::CSieveOfEratosthenes(unsigned int, unsigned int, __gmp_expr<__m
pz_struct [1], __mpz_struct [1]>&, __gmp_expr<__mpz_struct [1], __mpz_struct [1]>&, CBlockIndex*)
9.03 56.92 5.18 62611 0.08 0.91 MineProbablePrimeChain(CBlock&, __gmp_expr<__mpz_struct [1], __mpz_struct [1]>&, bool
&, unsigned int&, unsigned int&, unsigned int&, unsigned int&, unsigned int&, __gmp_expr<__mpz_struct [1], __mpz_struct [1]>&)
0.16 57.01 0.09 7019519 0.00 0.00 FermatProbablePrimalityTest(__gmp_expr<__mpz_struct [1], __mpz_struct [1]> const&, un
signed int&)
Without a doubt, the Weave function is the slowest of them all. I haven't yet dissected it (and won't really claim to understand what it's trying to do yet), but since this ultimately is buried way below the void static BitcoinMiner(CWallet *pwallet)
function, I'm guessing that anythign that would result in fewer calls to MineProbablePrimeChain would be a net very good thing. OTOH, further optimizing Weave still looks like a good bet.