-
Notifications
You must be signed in to change notification settings - Fork 55
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
Improve type inference #308
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #308 +/- ##
==========================================
- Coverage 73.45% 70.99% -2.46%
==========================================
Files 5 5
Lines 535 531 -4
==========================================
- Hits 393 377 -16
- Misses 142 154 +12 ☔ View full report in Codecov by Sentry. |
a8f34ae
to
35afff8
Compare
Co-authored-by: Gabriel Baraldi <[email protected]>
35afff8
to
55b8143
Compare
@@ -335,7 +335,12 @@ function destroy_deferred() | |||
# we'll do nothing (the other function will eventually run destroy_deferred). | |||
if !isempty(deferred_destroy_plans) && trylock(fftwlock) | |||
try | |||
foreach(unsafe_destroy_plan, deferred_destroy_plans) | |||
@static if Base.VERSION >= v"1.9" | |||
@inline foreach(unsafe_destroy_plan, deferred_destroy_plans) |
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.
Why is inlining needed here?
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.
The core issue is that foreach
in Base does not specialize on its function argument: https://github.com/JuliaLang/julia/blob/a007e807623f0bbb820315b8ce3340bd3d41262b/base/abstractarray.jl#L3213-L3214
This is missing something like foreach(f::F, ...) where F
which would cause this to specialize better - otherwise as-is it contains a dynamic dispatch. Arguably that should be fixed upstream, but this improves things for released versions of Julia too
This makes the following example compile with
--trim
: