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

Reduce number of allocations #224

Open
sethaxen opened this issue Oct 24, 2020 · 3 comments
Open

Reduce number of allocations #224

sethaxen opened this issue Oct 24, 2020 · 3 comments

Comments

@sethaxen
Copy link
Member

Right now there are a lot of unnecessary allocations. Eliminating all such allocations would probably impose too many constraints on the supportable HMC algorithms or require lots of code duplication, but we could still probably gain a lot of performance by at least mutating whenever we know the the vector being overwritten will never be needed for a sample or a sample statistic.

@xukai92
Copy link
Member

xukai92 commented Oct 26, 2020

Mohamed once had such an attempt (#76) but we didn't finally take it because it makes the code harder to read, and at that moment the package was still in fast dev. phase. I guess it's worth a revisit as the package seems to be stable for a while.

@sethaxen
Copy link
Member Author

sethaxen commented Nov 5, 2020

Thanks for the reference! I think after #228 and #214 are merged, it will be worth revisiting this. In addition to making code more efficient, adopting a mutating pattern should make the code of vectorized NUTS even simpler.

@xukai92
Copy link
Member

xukai92 commented Jan 8, 2021

Just to keep track of things: quick benchmark by @sethaxen (#214 (comment))

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

2 participants