-
-
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
Performance/type inference regression from #12327 #12476
Comments
As a short term solution you could add an indexed_next thing for pairs, as well as the corresponding hack in inference.jl. I have some ideas on how to solve this more generally (this is the same problem as the |
Would it help of immutable Pair{A,B}
pair::Tuple{A,B}
end That way the |
That might work, but it might not be great for non- |
It occurs to me that, in the heterogeneous key/value type case, #12327/#12261 causes us to lose type information. Consider basically any code that uses the
for (k, v) in dict
idiom, e.g.:Now consider what happens if the key and value types aren't the same. Previously, because we do fancy things for tuple destructuring, we could infer that
k
is of the key type K andv
is of the value type V. But we don't do these fancy things for Pair destructuring.code_warntype(f, (Dict{Float64,Int},))
shows that now we can only determine thatk
andv
are both of typeUnion{K,V}
. For the benchmark:On 6c34bc7 I get:
On the 0.3 branch I get:
The text was updated successfully, but these errors were encountered: