Closed SKopecz closed 8 months ago
It's done in that way because with arrays it would be type-unstable to choose the method based on size and such. But with StaticArrays, you have the information. I think we could specialize SArray/MArray directly to LUFactorization/SVDFactorization based on size @avik-pal ?
Ah that is the reason to create a cache for all types. Yeah I will get it fixed.
Should be fixed now
Great, thanks!
The following example demonstrates for StaticArrays that
DefaultAlgorithmChoice.LUFactorization
is significantly slower than explicitly requesting anLUFactorization
. The main reason for this is that in https://github.com/SciML/LinearSolve.jl/blob/e60a10a2e51c4d675cfe15dafaef1f43cd709d97/src/default.jl#L296 caches for all possible default algorithms are initialized and not just for the algorithm actually used. The flame graph below shows that over 40% of the time is unnecessarily spent ininit_cacheval
initializing GMRES, Cholesky-Factorization, SVD and so on. The problem also exists with other types of A and b, albeit to a lesser extent.It would be great if only the cache for the actual algorithm could be initialized.
I would also be interested to know why a distinction is made between
DefaultAlgorithmChoice.LUFactorization
andLUFactorization
at all.CC @ranocha