You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Alex D Herbert (JIRA)" <ji...@apache.org> on 2019/02/05 13:09:00 UTC

[jira] [Commented] (RNG-70) xoshiro generators

    [ https://issues.apache.org/jira/browse/RNG-70?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16760781#comment-16760781 ] 

Alex D Herbert commented on RNG-70:
-----------------------------------

Timings for initial implementations using {{org.apache.commons.rng.examples.jmh.GenerationPerformance}}:
{noformat}
java -version
openjdk version "1.8.0_191"
OpenJDK Runtime Environment (build 1.8.0_191-8u191-b12-2ubuntu0.16.04.1-b12)
OpenJDK 64-Bit Server VM (build 25.191-b12, mixed mode)
{noformat}
Providers have been compared to the current fastest provider (SplitMix).

Note: XO_RO_SHI_RO_64_S and those ending _PLUS are suitable only for floating-point generation where the lower order bits are discarded.

 

64-bit providers:
||numValues||randomSourceName||Method||Score||Error||Relative||
|1000000|SPLIT_MIX_64|nextLong|4000.72|27.53|1|
|1000000|XO_RO_SHI_RO_128_PLUS|nextLong|3379.82|48.76|0.8448029355|
|1000000|XO_RO_SHI_RO_128_SS|nextLong|3719.26|26.65|0.9296476634|
|1000000|XO_SHI_RO_256_PLUS|nextLong|3783.37|25.13|0.945672279|
|1000000|XO_SHI_RO_256_SS|nextLong|4237.3|68.48|1.0591343558|
|1000000|XO_SHI_RO_512_PLUS|nextLong|5405.84|422.45|1.351216781|
|1000000|XO_SHI_RO_512_SS|nextLong|6017.05|628.07|1.5039917815|

The results do not match the timings on the original source website where they all outperform a SplitMix64 generator. In this case some are faster and others are slower. Timings on the source website are for C code using gcc.

The XO_RO_SHI_RO_128_SS provider is an all-purpose provider with a larger period than SplitMix and faster performance. The other all-purpose providers are slower.

32-bit providers:
||numValues||randomSourceName||Method||Score||Error||Relative||
|1000000|SPLIT_MIX_64|nextInt|3742.07|10.43|1|
|1000000|XO_RO_SHI_RO_64_S|nextInt|3329.45|11.59|0.8897348259|
|1000000|XO_RO_SHI_RO_64_SS|nextInt|3628.13|22.66|0.9695516118|
|1000000|XO_SHI_RO_128_PLUS|nextInt|3833.14|6.78|1.0243367975|
|1000000|XO_SHI_RO_128_SS|nextInt|4227.6|58.73|1.1297490426|

No comparative timings exist on the original source website for the 32-bit providers. Performance is good compared to the SplitMix provider. Note that the nextInt method for the SplitMix divides a {{long}} into two {{int}} values. Timings verses the current fastest native 32-bit generator (MWC_256) showed that the MWC_256 was slower than the SplitMix.

 

 

> xoshiro generators
> ------------------
>
>                 Key: RNG-70
>                 URL: https://issues.apache.org/jira/browse/RNG-70
>             Project: Commons RNG
>          Issue Type: New Feature
>          Components: core, simple
>            Reporter: Alex D Herbert
>            Priority: Major
>             Fix For: 1.3
>
>
> The authors of the algorithm implemented in {{org.apache.commons.rng.core.source64.XorShift1024Star}} have produced new generators as described here:
> [xorshiro / xoroshiro generators|http://xoshiro.di.unimi.it]
> I propose to implement the *all purpose* algorithms using the following classnames:
> {code:java}
>     source32.XoShiRo128StarStar
>     source64.XoRoShiRo128StarStar
>     source64.XoShiRo256StarStar
>     source64.XoShiRo512StarStar
>     source64.XorShift1024Phi
> {code}
> The algorithms are simple to adapt from the c source code and I have created working versions with units tests (analogous to the {{XorShift1024Star}} test).
> Each generator must have a corresponding name in the {{RandomSource}} enum. I propose:
> {code:java}
>     XO_SHI_RO_128_SS,
>     XO_RO_SHI_RO_128_SS,
>     XO_SHI_RO_256_SS,
>     XO_SHI_RO_512_SS,
>     XOR_SHIFT_1024_PHI,
> {code}
> Note: XorShift1024Phi is an updated implementation of XorShift1024Star using a different multiplier. To share code this could be implemented by moving the implementation to an abstract base class for both XorShift1024Phi and XorShift1024Star which accepts the multiplier in the constructor.
> The authors also provide code for *faster generators* for use in creating floating-point random numbers where the lower order bits are discarded. These could be named:
> {code:java}
>     source32.XoShiRo128Plus
>     source64.XoRoShiRo128Plus
>     source64.XoShiRo256Plus
>     source64.XoShiRo512Plus
>     XO_SHI_RO_128_PLUS,
>     XO_RO_SHI_RO_128_PLUS,
>     XO_SHI_RO_256_PLUS,
>     XO_SHI_RO_512_PLUS,
> {code}
> For discussion:
> * The names of the generators.
> * Should the small state 64-bit generator XoRoShiRo128StarStar be implemented? It has a potentially confusing name clash with the 32-bit generator XoShiRo128StarStar. Speed is expected to be the same as XoShiRo256Star but using only half the memory footprint.
> * Should the faster floating-point generators be implemented?



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)