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 Herbert (Jira)" <ji...@apache.org> on 2021/07/08 08:51:00 UTC

[jira] [Commented] (RNG-150) Update samplers to use the ziggurat exponential sampler

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

Alex Herbert commented on RNG-150:
----------------------------------

This change also applies to the GeometricSampler. Here is the current performance when using the AhrensDieterExponentialSampler:
{noformat}
Benchmark                              (probabilityOfSuccess)   (randomSourceName)                    (samplerType)  Mode  Cnt   Score   Error  Units
GeometricSamplersPerformance.baseline                     N/A                  N/A                              N/A  avgt    5   2.274 ± 0.010  ns/op
GeometricSamplersPerformance.sample                       0.1  XO_RO_SHI_RO_128_PP                 GeometricSampler  avgt    5  28.249 ± 0.101  ns/op
GeometricSamplersPerformance.sample                       0.1  XO_RO_SHI_RO_128_PP  InverseTransformDiscreteSampler  avgt    5  52.946 ± 0.129  ns/op
GeometricSamplersPerformance.sample                       0.3  XO_RO_SHI_RO_128_PP                 GeometricSampler  avgt    5  29.253 ± 0.442  ns/op
GeometricSamplersPerformance.sample                       0.3  XO_RO_SHI_RO_128_PP  InverseTransformDiscreteSampler  avgt    5  51.363 ± 0.115  ns/op
{noformat}
Here is the performance after changing to ZigguratSampler.Exponential:
{noformat}
Benchmark                              (probabilityOfSuccess)   (randomSourceName)                    (samplerType)  Mode  Cnt   Score   Error  Units
GeometricSamplersPerformance.baseline                     N/A                  N/A                              N/A  avgt    5   2.982 ± 0.018  ns/op
GeometricSamplersPerformance.sample                       0.1  XO_RO_SHI_RO_128_PP                 GeometricSampler  avgt    5  11.074 ± 0.013  ns/op
GeometricSamplersPerformance.sample                       0.1  XO_RO_SHI_RO_128_PP  InverseTransformDiscreteSampler  avgt    5  52.994 ± 0.110  ns/op
GeometricSamplersPerformance.sample                       0.3  XO_RO_SHI_RO_128_PP                 GeometricSampler  avgt    5  13.118 ± 0.041  ns/op
GeometricSamplersPerformance.sample                       0.3  XO_RO_SHI_RO_128_PP  InverseTransformDiscreteSampler  avgt    5  51.416 ± 0.391  ns/op
{noformat}
Approximately 2.5x faster.

> Update samplers to use the ziggurat exponential sampler
> -------------------------------------------------------
>
>                 Key: RNG-150
>                 URL: https://issues.apache.org/jira/browse/RNG-150
>             Project: Commons RNG
>          Issue Type: Improvement
>          Components: sampling
>    Affects Versions: 1.3
>            Reporter: Alex Herbert
>            Assignee: Alex Herbert
>            Priority: Trivial
>             Fix For: 1.4
>
>
> The LargeMeanPoissionSampler uses a standard exponential deviate.
> The GeometricSampler uses an exponential deviate.
> These can be changed from the AhrensDieterExponentialSampler to the ziggurat exponential sampler which is 4x faster.
>  



--
This message was sent by Atlassian Jira
(v8.3.4#803005)