Skip to content

Reduce allocations in residual function #2234

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

Merged
merged 1 commit into from
Apr 14, 2025
Merged

Reduce allocations in residual function #2234

merged 1 commit into from
Apr 14, 2025

Conversation

visr
Copy link
Member

@visr visr commented Apr 11, 2025

Continuing from #2224:

18.086399 seconds (4.01 M allocations: 3.255 GiB, 2.81% gc time)
17.879659 seconds (2.95 M allocations: 2.949 GiB, 1.69% gc time)

Adding the type assert on the function does the trick. I also go rid of the isdae check because it shouldn't be needed, and I noticed get_dae_uprev leads to runtime dispatch since it is using isdefined(integrator, ...)

There are still more optimizations to be made to backtracking, but good to bag this one already.
I also noticed many extra allocations if concentration = true, we should also look at that.

@visr visr merged commit 11f1805 into main Apr 14, 2025
20 checks passed
@visr visr deleted the residual-allocations branch April 14, 2025 13:26
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

Successfully merging this pull request may close these issues.

1 participant