I have code doing some broadcasted operations and it takes ~2 microseconds which is great
ΔU2 += sum((Δuᵢ .* u .* @view F2[:,i]) .+ (Δuⱼ .* u .* @view F2[:,j]) .+ (Δuₖ .* u .* @view F2[:,k]))
However, this is entirely unreadable in my opinion. My original code had extra variables defined for some parts of this operation:
uᵢrow = Δuᵢ .* u uⱼrow = Δuⱼ .* u uₖrow = Δuₖ .* u
These variables are never used again in the function and were only created for readability. If I benchmark the two cases the first case where I just put everything in one line is faster because the compiler did not have to allocate new memory for the variables. Is this an intended feature of the compiler or just an existing limitation? is there some way to have these variables for readability without taking a performance hit?