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
The broadcast code is not type stable, see below. The code seems quite complicated with generated functions, so I think the best would be to right special case code for the vector and matrix case.
Made a quick-and-dirty type stable vector version that is roughly 4x faster:
functionfastbroadcast!(dest, bc)
@inboundsfor K inblockaxes(bc)[1]
KI = K[1:Int(K)]
broadcast!(bc.f, view(dest,KI), __bview(bc.args, KI)...)
end
dest
end
Note the KI = K[1:Int(K)] should in theory be completely unnecessary, however, in my case without it (that is, just using view(.., K)), it's 20x slower. This is because in my test problem view(bc.args[j], KI) returns a Range, where view(bc.args[j],K) returns a view, adding extra computation. #138 provides an alternative solution to simplify this.
The broadcast code is not type stable, see below. The code seems quite complicated with generated functions, so I think the best would be to right special case code for the vector and matrix case.
The text was updated successfully, but these errors were encountered: