commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Luc Maisonobe <>
Subject Re: [math] new pseudo random number generators
Date Mon, 20 Sep 2010 22:36:39 GMT
Le 20/09/2010 15:28, Mikkel Meyer Andersen a écrit :

> I would like to see/try a comparison between the default and new PRNG
> under different conditions. Just to get an idea of how they perform.

I gave it a try. The version from yesterday was really slow (about 3
times slower than other generators). It seems the JVM optimizer (at
least on my computer) was not able to inline everything. So I inlined
myself and also tried several different tricks to avoid modulo
operations in indices. I ended up with a solution different from the one
of the authors: I used precomputed indices arrays. This increase data
size by a factor 6 but really speeds up generation.

Here are my results, using a 64 bits JVM on a linux computer with a 2
years old processor (AMD phenom Quad 9550 at 2.2 GHz):

generation rate for MersenneTwister: about 27 millions doubles per
second (remember I generate two 32 bits integers for each double).

generation rates for other PRNG, relative to MersenneTwister:

MersenneTwister    1.0
JDKRandomGenerator 1.16
Well512a           0.85
Well1024a          0.63
Well19937a         0.71
Well19937c         0.57
Well44497a         0.69
Well44497b         0.65

So JDK is 16% faster than MersenneTwister (but very poor) and the new
generators are between 15% slower and 43% slower. The order of magnitude
are the same. I could perhaps optimize a little further for example by
generating several numbers and caching them but am not sure this is
worth the effort.

I have sent a mail to the paper authors with our questions.


To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message