Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions base/abstractarray.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2736,10 +2736,8 @@ function hvncat_fill!(A::AbstractArray{T, N}, scratch1::Vector{Int}, scratch2::V
startindex = CartesianIndex(ntuple(i -> offsets[i] + 1, Val(N)))
if isa(a, AbstractArray)
if !isempty(a)
if length(a) > 4
endindex = CartesianIndex(ntuple(i -> offsets[i] + cat_size(a, i), Val(N)))
@inbounds A[startindex:endindex] = a
else
if isa(a, Array) && length(a) ≤ 4
# Optimization for small iterable arrays
for ai ∈ a
@inbounds Ai = hvncat_calcindex(offsets, inneroffsets, outdimsprod, N)
@inbounds A[Ai] = ai
Expand All @@ -2749,6 +2747,9 @@ function hvncat_fill!(A::AbstractArray{T, N}, scratch1::Vector{Int}, scratch2::V
inneroffsets[j] = 0
end
end
else
endindex = CartesianIndex(ntuple(i -> offsets[i] + cat_size(a, i), Val(N)))
@inbounds A[startindex:endindex] = a
end
end
else
Expand Down
Loading