-
Notifications
You must be signed in to change notification settings - Fork 112
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
Avoid type instability in SemidiscretizationCoupled
#1979
Avoid type instability in SemidiscretizationCoupled
#1979
Conversation
Review checklistThis checklist is meant to assist creators of PRs (to let them know what reviewers will typically look for) and reviewers (to guide them in a structured review process). Items do not need to be checked explicitly for a PR to be eligible for merging. Purpose and scope
Code quality
Documentation
Testing
Performance
Verification
Created with ❤️ by the Trixi.jl community. |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1979 +/- ##
==========================================
- Coverage 96.16% 96.16% -0.00%
==========================================
Files 460 460
Lines 36958 36968 +10
==========================================
+ Hits 35539 35548 +9
- Misses 1419 1420 +1
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
Looks fine to me now. |
We see a huge amount of allocations in CI: |
Okay, so the version on mesh_other, equations_other, solver_other, cache_other = mesh_equations_solver_cache(other_semi_index,
1,
semi_coupled.semis...) is type-stable, as the types of the return values will be the same over all values of The version in this PR always allocates, but one level higher, where the type-instability is not as performance-relevant. |
…i.jl into coupled-type-instability
Okay, new version. |
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.
This is unbelievably ugly but I believe that @efaulhaber needs this quickly for a teaching project. IMHO OK to merge if @ranocha signs off as well.
Just to be clear: Thanks a lot to @efaulhaber for taking the time and figuring out how to make this allocation free. Your help is really appreciated! |
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.
Happy to merge.
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.
Since @sloede says it's urgent for a teaching project, I will merge this now. Please create a follow-up PR adding some comments why this structure is required.
Before:
Now: