Skip to content

Performance improvements to csm using LazyArrays

ollyl requested to merge csm-performance into master

Added LazyArrays to improve csm performance. Basically the inner loop

for m in 1:M
    for j in m:M
        ds .= Sc[m].*S[j]
        C[j,m,:] = mean!(Pxy,ds)
    end
end

is replaced by:

for m in 1:M
    for j in m:M
        C[j,m,:] .= dropdims(mean(LazyArray(@~ Sc[m].*S[j]),dims=2);dims=2)
    end
end

Gives approx performance improvement of 1.3X, however, with an increase in allocations.

Merge request reports