Skip to content
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

sampling distributions #19

Open
ewitwer opened this issue Apr 30, 2024 · 0 comments
Open

sampling distributions #19

ewitwer opened this issue Apr 30, 2024 · 0 comments

Comments

@ewitwer
Copy link
Collaborator

ewitwer commented Apr 30, 2024

Right now, every time a Dist is sampled, a new rand_distr distribution is created and subsequently discarded. Since sampling distributions is a major factor in Maybenot's runtime, it may be desirable to change this.

With one exception, all distributions currently included in the framework have a constant-time new function - some simply check parameter validity and return an instance of the relevant struct (e.g. Normal), and others require some additional logic (e.g. Beta and Poisson). The Geometric distribution has a new function whose runtime depends on the shape parameter, but only a few loop iterations should occur, even with very small probabilities.

From the above, there may be minimal benefit to storing a persistent rand_distr distribution in each Dist, also because this would make the Dist type's size dynamic. Benchmark tests with a prototype implementation may shed more light on this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant