[
https://issues.apache.org/jira/browse/RNG-57?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16695468#comment-16695468
]
Gilles commented on RNG-57:
---------------------------
I'm worried by the {{nextBoolean}} benchmark result:
{noformat}
*--------------------------*----------------+
|| RNG identifier || Score ratio |
*--------------------------*----------------+
| MWC_256 | 0.89062 |
*--------------------------*----------------+
| MT | 0.90006 |
*--------------------------*----------------+
| KISS | 0.90939 |
*--------------------------*----------------+
| WELL_44497_B | 0.93249 |
*--------------------------*----------------+
| WELL_19937_A | 0.93395 |
*--------------------------*----------------+
| WELL_44497_A | 0.93663 |
*--------------------------*----------------+
| ISAAC | 0.94705 |
*--------------------------*----------------+
| WELL_512_A | 0.94886 |
*--------------------------*----------------+
| WELL_19937_C | 0.95391 |
*--------------------------*----------------+
| WELL_1024_A | 0.96226 |
*--------------------------*----------------+
| JDK | 1.00000 |
*--------------------------*----------------+
| SPLIT_MIX_64 | 1.04807 |
*--------------------------*----------------+
| TWO_CMRES | 1.05701 |
*--------------------------*----------------+
| MT_64 | 1.08643 |
*--------------------------*----------------+
| XOR_SHIFT_1024_S | 1.08982 |
*--------------------------*----------------+
{noformat}
> CachedUniformRandomProvider for nextBoolean() and nextInt()
> -----------------------------------------------------------
>
> Key: RNG-57
> URL: https://issues.apache.org/jira/browse/RNG-57
> Project: Commons RNG
> Issue Type: Improvement
> Components: core
> Reporter: Alex D Herbert
> Priority: Minor
> Labels: performance
> Fix For: 1.2
>
>
> Implement a wrapper around a {{UniformRandomProvider}} that can cache the
> underlying source of random bytes for use in the methods {{nextBoolean()}}
> and {{nextInt()}} (in the case of {{LongProvider}}). E.g.
> {code:java}
> LongProvider provider = RandomSource.create(RandomSource.SPLIT_MIX_64);
> CachedLongProvider rng = new CachedLongProvider(provider);
> // Uses cached nextLong() 64 times
> rng.nextBoolean();
> // Uses cached nextLong() twice
> rng.nextInt();
> IntProvider provider = RandomSource.create(RandomSource.KISS);
> CachedIntProvider rng2 = new CachedIntProvider(provider);
> // Uses cached nextInt() 32 times
> rng2.nextBoolean();
> // This could be wrapped by a factory method:
> UniformRandomProvider rng = CachedUniformRandomProviderFactory.wrap(
> // Any supported source: IntProvider or LongProvider
> RandomSource.create(RandomSource...));
> {code}
> The implementation should be speed tested to determine the benefit for
> {{nextBoolean()}} and if {{nextInt()}} can be improved for {{LongProviders}}.
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)