Open stakaz opened 5 years ago
I believe the root cause is that inference gives up on nested zip iterators:
julia> @code_warntype sum(x->x[1][1], zip(zip([1,2,3])))
Body::Any
1 ─ %1 = Base.add_sum::Core.Compiler.Const(Base.add_sum, false)
│ %2 = invoke Base.mapfoldl_impl(_2::Function, %1::Function, $(QuoteNode(NamedTuple()))::NamedTuple{(),Tuple{}}, _3::Base.Iterators.Zip{Tuple{Base.Iterators.Zip{Tuple{Array{Int64,1}}}}})::Any
└── return %2
Hello, I was hitting the following problem: when using nested
zip
functions julia is somehow not able to generate fast code on the first run but on the second run the function becomes fast. An example isHere, the first time
@code_warntype
is reporting some bad things but running the code again removes this and the function is much faster.There is a discussion on discourse and I was suggested to submit an issue for this here.
Please help me to find a solution for this as it really slows down my calculations considerable. Thanks.