-
-
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 and typing of 6+ dimensional generators #21058
Comments
julia> g6=(+(a,b,c,d,e,f) for a in 1:1, b in 1:1, c in 1:1, d in 1:1, e in 1:1, f in 1:1);
julia> Core.Inference.return_type(next, Tuple{typeof(g6), typeof(start(g6))})
Tuple{Int64,Tuple{Int64,Tuple{Int64,Tuple{Int64,Tuple{Int64,#=Note this one!=#Tuple#==#,Nullable{Tuple{Int64,Int64}},Bool},Nullable{Tuple{Int64,Int64,Int64}},Bool},Nullable{NTuple{4,Int64}},Bool},Nullable{NTuple{5,Int64}},Bool}}
#temp#@_50::Tuple{Tuple{Int64,NTuple{5,Int64}},Tuple{Int64,Tuple{Int64,Tuple{Int64,Tuple{Int64,Tuple,Nullable{Tuple{Int64,Int64}},Bool},Nullable{Tuple{Int64,Int64,Int64}},Bool},Nullable{NTuple{4,Int64}},Bool},Nullable{NTuple{5,Int64}},Bool}} = (Core.tuple)((Core.tuple)(SSAValue(80), v2@_14::NTuple{5,Int64})::Tuple{Int64,NTuple{5,Int64}}, (Core.tuple)((Core.getfield)((Core.getfield)(SSAValue(3), :a)::UnitRange{Int64}, :start)::Int64, s2@_12::Tuple{Int64,Tuple{Int64,Tuple{Int64,Tuple{Int64,Int64,Nullable{Int64},Bool},Nullable{Tuple{Int64,Int64}},Bool},Nullable{Tuple{Int64,Int64,Int64}},Bool},Nullable{NTuple{4,Int64}},Bool}, $(Expr(:new, :($(QuoteNode(Nullable{NTuple{5,Int64}}))), false)), (Base.getfield)(s2@_12::Tuple{Int64,Tuple{Int64,Tuple{Int64,Tuple{Int64,Int64,Nullable{Int64},Bool},Nullable{Tuple{Int64,Int64}},Bool},Nullable{Tuple{Int64,Int64,Int64}},Bool},Nullable{NTuple{4,Int64}},Bool}, 4)::Bool)::Tuple{Int64,Tuple{Int64,Tuple{Int64,Tuple{Int64,Tuple{Int64,Int64,Nullable{Int64},Bool},Nullable{Tuple{Int64,Int64}},Bool},Nullable{Tuple{Int64,Int64,Int64}},Bool},Nullable{NTuple{4,Int64}},Bool},Nullable{NTuple{5,Int64}},Bool})::Tuple{Tuple{Int64,NTuple{5,Int64}},Tuple{Int64,Tuple{Int64,Tuple{Int64,Tuple{Int64,Tuple,Nullable{Tuple{Int64,Int64}},Bool},Nullable{Tuple{Int64,Int64,Int64}},Bool},Nullable{NTuple{4,Int64}},Bool},Nullable{NTuple{5,Int64}},Bool}} which comes from this line. Even though the type of --- a/base/inference.jl
+++ b/base/inference.jl
@@ -23,7 +23,7 @@ struct InferenceParams
function InferenceParams(world::UInt;
inlining::Bool = inlining_enabled(),
tupletype_len::Int = 15,
- tuple_depth::Int = 4,
+ tuple_depth::Int = 5,
tuple_splat::Int = 16,
union_splitting::Int = 4,
apply_union_enum::Int = 8) inference of |
FWIW, I've tried setting |
No, we should probably make it smaller. But we don't currently really have any tests for it. |
Oh. Would you then suggest to rewrite the generator/iterator code to improve its inferability (or least not make it worse) or do you have additional changes to type inference in mind that would help here? |
This seems fixed by the new |
Is it sufficiently tracked by existing benchmarks that we'd notice it regressing, or should we add the needs-benchmark label? |
Good question, this might need either a benchmark or an inferred test (or both), especially since inference of certain other tuple manipulations seem to have regressed on master (#22513). |
Fixed but would still be good to add a benchmark (which is why the label is there). |
Type inference seems to lose the trail with a 6-dimensional generator:
This causes a fairly substantial regression from 0.4.7 when using comprehensions:
(ref http://stackoverflow.com/questions/42826871/slowdown-in-0-5-and-0-6/42827923#comment72790727_42827923)
The text was updated successfully, but these errors were encountered: