-
Notifications
You must be signed in to change notification settings - Fork 432
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Poisson: split Knuth/Rejection methods #1493
Conversation
With #[inline] on all sample methods there is no effect on benchmarks; as presented there is <2% on most, +8% time on variable benchmark.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like the thought behind the change, it doesn't make sense to decide which method to use every single time a Poisson distribution is sampled. Using an enum is cleaner. I have some thoughts on the details.
I can't comment too well on the benchmarking code, as I am unfamiliar with criterion and don't understand the reasons for many of the changes. I'm gonna go learn about Criterion now 🤠
changes.patch |
Great, looks good to me now haha 😄 Unless you want to also add the getter for |
Summary
Use an enum over Poisson implementations
Motivation
#1484 uses the
Poisson
method internally, but only for small expected values.@benjamin-lieser please merge this PR into yours and use
poisson::KnuthMethod
instead ofPoisson
.