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
For convenience we often use cat(X..., dims=p) statements to concatenate vectors and matrices. During some profile I see these become terribly inefficient at even moderate problems. We should probably remove them. As an example"
X = [zeros(3,3) for i =1:1000]
# option 1
xx =cat(X...,dims=3)
# option 2functionsquidge(X::AbstractVector)
xx =zeros(size(X[1],1),size(X[1],2),length(X))
for i =1:length(X)
xx[:,:,i] = X[i]
endreturn xx
end
xx =squidge(X)
For convenience we often use
cat(X..., dims=p)
statements to concatenate vectors and matrices. During some profile I see these become terribly inefficient at even moderate problems. We should probably remove them. As an example"option 1 gives e.g.:
0.037136 seconds (10.01 k allocations: 13.965 MiB)
option 2 gives e.g.:
0.000088 seconds (2 allocations: 70.375 KiB)
Action
Replace
cat(X...,dims=p)
with the appropriate loops.The text was updated successfully, but these errors were encountered: