[
https://issues.apache.org/jira/browse/RNG-51?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Gilles resolved RNG-51.
-----------------------
Resolution: Implemented
Fix Version/s: 1.2
commit 5e62c08f7449020b8ddc67725afc759980557c51
> PoissonSampler single use speed improvements using a cache
> ----------------------------------------------------------
>
> Key: RNG-51
> URL: https://issues.apache.org/jira/browse/RNG-51
> Project: Commons RNG
> Issue Type: Improvement
> Affects Versions: 1.1
> Reporter: Alex D Herbert
> Priority: Minor
> Labels: performance
> Fix For: 1.2
>
>
> This improvement is a follow on from RNG-50.
> That improved the PoissonSampler by splitting it into two samplers for the
> different algorithms (SmallMeanPoissonSampler and LargeMeanPoissonSampler)
> and moving initialisation computations from the sample method into the
> constructor. This improved the speed of repeat use of the same sampler by up
> to 3-fold. It does not effect single-use of a sampler.
> In the case of the LargeMeanPoissonSampler the initialisation 'state'
> computed within the constructor involves 2 Math.log, 2 Math.exp, 2 Math.sqrt
> and 1 logFactorial computations. If the sampler is used to generate only 1
> sample then the cost of computing the state is a significant portion of the
> sample time.
> However the state is not unique to the mean of the Poisson distribution but
> the {{(int)Math.floor(mean)}}. This means the initialisation state can be
> shared and reused by PoissonSamplers with different means.
> This was demonstrated using a JMH benchmark speed test comparing the standard
> PoissonSampler verses a PoissonSamplerCache that can store the initialisation
> state of the PoissonSampler.
> For single-use Poisson samples with a mean within a known range the cache can
> provide 1.3 to 2x speed-up as initialisation state can be reused.
> The original benchmark was performed using Version 1.0. The Version 1.1.
> samplers use a new faster Gaussian sampler internally. So the benchmark
> should be repeated for Version 1.1.
> The test project containing the V1.0 JMH benchmark is here:
> [poisson-sampler-test-code|https://github.com/aherbert/poisson-sampler-test-code]
> I propose to update this project to reference V1.1 of Commons RNG and repeat
> the test of the PoissonSamplerCache. Results will be posted when available.
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)