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

Unnecessary heap allocation? #41

Closed
himanshugupta1009 opened this issue Dec 5, 2023 · 2 comments
Closed

Unnecessary heap allocation? #41

himanshugupta1009 opened this issue Dec 5, 2023 · 2 comments

Comments

@himanshugupta1009
Copy link
Contributor

This line

return grid.index[1:l]::Vector{Int}, grid.weight[1:l]::Vector{Float64}
allocates new vectors.

It seems like over-optimization to save a few Float computations at the expense of allocations which stresses the garbage collector. Is there a way to get around it? If not, is it possible to just avoid the extra check performed at line 229?

Thanks!

@mykelk
Copy link
Member

mykelk commented Dec 5, 2023

Thanks for the idea! Feel free to contribute a PR with some empirical results on timing.

@himanshugupta1009
Copy link
Contributor Author

I have created a PR for this issue with some empirical results. If there are any issues with it, let me know. Thanks!

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