class SplittableRandom

Doug Lea dl at
Tue Jul 16 19:19:46 UTC 2013

On 07/16/13 14:57, Guy Steele wrote:

> So instead I took the latest version and modified the generation of gamma values
> to use a 56-bit GAMMA_GAMMA value and perform arithmetic modulo 2^56-5 ...

> So here's the punchline: this change makes my Monte Carlo calculation of pi run over 19% faster!
> Hard to believe.  It's certainly avoiding most of the hard work in addGammaModGeorge,
> and perhaps also making branch prediction totally win, but 19% ???  Someone please verify this
> independently.

I tried this on a few other simple tests and I see varying improvements
on different machines from about 8% to 15%. So this does seem worth

(Aside to casual observers on this list: Sometimes it does
pay off to obsess so much over a couple of "if" statements.)


More information about the core-libs-dev mailing list