-
-
Notifications
You must be signed in to change notification settings - Fork 34
Closed
Description
Matrix-matrix multiplication with types A <: Adjoint{T, SparseMatrixCSC{T, N}} and B <: Diagonal is significantly slower in Julia 1.11 than in Julia 1.10. The MWE below executes in O(n) time with Julia 1.10, and in O(n2) time with Julia 1.11.
The performance regression appears to have been introduced in PR JuliaLang/julia#52389 that removed specialized methods.
MWE
using LinearAlgebra
using SparseArrays
using BenchmarkTools
n = 100;
A = adjoint(sparse(Float64, I, n, n));
B = Diagonal(ones(n));
print("Julia ", VERSION, ", n = ", n, ":")
@btime *($A, $B)
Output:
Julia 1.10.8, n = 100: 531.160 ns (5 allocations: 2.59 KiB)
Julia 1.11.3, n = 100: 65.927 μs (10 allocations: 8.53 KiB)
Julia 1.10.8, n = 1000: 4.626 μs (5 allocations: 23.88 KiB)
Julia 1.11.3, n = 1000: 6.240 ms (13 allocations: 57.38 KiB)
Julia 1.10.8, n = 10000: 43.303 μs (6 allocations: 234.73 KiB)
Julia 1.11.3, n = 10000: 623.509 ms (13 allocations: 666.56 KiB)
Julia 1.10.8, n = 100000: 450.953 μs (6 allocations: 2.29 MiB)
Julia 1.11.3, n = 100000: 62.992 s (13 allocations: 5.01 MiB)
These results are on a Linux x86-64 platform; similar results were observed on MacOS x86-64.
Metadata
Metadata
Assignees
Labels
No labels