-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
work around a splatting penalty in twiceprecision #29060
Conversation
Oh interesting. We have special support for splatting tuples, but this is sometimes splatting numbers to just pass one argument, and there we hit the pessimistic case: julia> f(x) = println(x...)
f (generic function with 1 method)
julia> @code_typed f(1)
CodeInfo(
1 1 ─ %1 = (Core._apply)(Main.println, x)::Const(nothing, false) │
└── return %1 │
) => Nothing
julia> @code_typed f((1,2))
CodeInfo(
1 1 ─ %1 = (getfield)(x, 1)::Int64 │
│ %2 = (getfield)(x, 2)::Int64 │
│ %3 = invoke Main.println(%1::Int64, %2::Int64)::Const(nothing, false)│
└── return %3 │
) => Nothing Maybe add an |
I think Jarrett was working on this some in #28955 |
Ref. #27434 (comment) re. elision of |
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.
LGTM, though we should fix the underlying compiler issue also.
When that happens I'll happily revert :) |
* work around a splatting penalty in twiceprecision * add allocation test (cherry picked from commit 88d536a)
* work around a splatting penalty in twiceprecision * add allocation test (cherry picked from commit 88d536a)
* work around a splatting penalty in twiceprecision * add allocation test (cherry picked from commit 88d536a)
* work around a splatting penalty in twiceprecision * add allocation test (cherry picked from commit 88d536a)
But keep the test. This workaround is no longer required, because the compiler can now understand this pattern. This reverts commit 88d536a.
…29060)" (JuliaLang#36728) But keep the test. This workaround is no longer required, because the compiler can now understand this pattern. This reverts commit 88d536a.
Before:
After:
Ref https://discourse.julialang.org/t/a-possible-regression-in-0-7/14597
The typed code before this PR looks like
so not sure why that is not devirtualized (if this is the correct term here).