I discovered that the results of my previous post today were obtained NOT with 32-bit R
but with 64-bit R.
I was running the script within the R-bundle of the editor TextMate; it uses 64-bit R and
I don't know how to change that.
Sorry about this.
The correct 32-bit results are
RNGmethod ctype result user system elapsed
1 Inversion loop 0.05118006 2.081 0.012 2.093
2 Inversion iteration 0.05154388 1.930 0.226 2.157
3 Kinderman-Ramage loop 0.05292662 1.503 0.047 1.549
4 Kinderman-Ramage iteration 0.05189927 1.334 0.228 1.562
5 Box-Muller loop 0.05266636 1.750 0.024 1.773
6 Box-Muller iteration 0.05138073 1.610 0.226 1.836
7 Ahrens-Dieter loop 0.05259550 1.461 0.025 1.486
8 Ahrens-Dieter iteration 0.05209534 1.298 0.229 1.526
This is more in line with my post of the 22nd december.
It also clearly show that the 64-bit version of R is quite a bit quicker in this case.
There is a package on CRAN: SuppDists which provides the ziggurat method for generating
from a normal distribution.
Warning: it only runs correctly in a 32-bit environment.
Results:
RNGmethod ctype result user system elapsed
1 ziggurat loop 0.05240394 0.837 0.014 0.851
2 ziggurat iteration 0.05200224 0.541 0.362 0.902
Faster indeed.
But the system overhead in the "iteration" (or vectorized) version is rather
large.
Berend