You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This seems to be caused by type instabilities in vcat_getindex, as can be checked with @code_warntype LazyArrays.vcat_getindex(A, N). More precisely, the problem is in the loop:
for A in f.args
n =length(A)
κ ≤ n &&returnconvert(T,A[κ])::T
κ -= n
end
where A can be any of the concatenated subarrays.
The same issue occurs with setindex!, and also with two-dimensional concatenated arrays (Vcat{2} and Hcat).
I've been playing with a possible fix using recursive iteration over the f.args tuple, and I'll submit a PR soon.
The text was updated successfully, but these errors were encountered:
Indexing heterogeneous concatenated arrays is slow due to type instability issues. By heterogeneous I mean something like:
where each concatenated subarray may have different type.
Indexing the first subarray is relatively fast, while indexing subsequent arrays becomes slower and allocates memory. On Julia 1.5.1:
This seems to be caused by type instabilities in
vcat_getindex
, as can be checked with@code_warntype LazyArrays.vcat_getindex(A, N)
. More precisely, the problem is in the loop:where
A
can be any of the concatenated subarrays.The same issue occurs with
setindex!
, and also with two-dimensional concatenated arrays (Vcat{2}
andHcat
).I've been playing with a possible fix using recursive iteration over the
f.args
tuple, and I'll submit a PR soon.The text was updated successfully, but these errors were encountered: