Skip to content

Conversation

@jishnub
Copy link
Member

@jishnub jishnub commented Aug 29, 2024

This provides most of the benefits seen in #55604. The simpler implementation appears to help with branch-prediction in inferring the zero elements of the structured matrices.
The improved performance as a consequence:

julia> using LinearAlgebra

julia> U = UpperTriangular(rand(3000,3000)); D = Diagonal(rand(size(U,1)));

julia> @btime $U .+ $D;
  23.405 ms (3 allocations: 68.66 MiB) # nightly
  15.266 ms (3 allocations: 68.66 MiB) # This PR

@jishnub jishnub added performance Must go faster linear algebra Linear algebra arrays [a, r, r, a, y, s] labels Aug 29, 2024
@jishnub jishnub requested a review from ViralBShah August 29, 2024 16:03
Co-authored-by: Matt Bauman <[email protected]>
@jishnub jishnub removed the request for review from ViralBShah August 30, 2024 03:15
@jishnub jishnub merged commit fdc1090 into master Aug 30, 2024
@jishnub jishnub deleted the jishnub/structuredmatrix_newindex branch August 30, 2024 03:15
KristofferC pushed a commit that referenced this pull request Sep 12, 2024
This provides most of the benefits seen in
#55604. The simpler
implementation appears to help with branch-prediction in inferring the
zero elements of the structured matrices.
The improved performance as a consequence:
```julia
julia> using LinearAlgebra

julia> U = UpperTriangular(rand(3000,3000)); D = Diagonal(rand(size(U,1)));

julia> @Btime $U .+ $D;
  23.405 ms (3 allocations: 68.66 MiB) # nightly
  15.266 ms (3 allocations: 68.66 MiB) # This PR
```

---------

Co-authored-by: Matt Bauman <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

arrays [a, r, r, a, y, s] linear algebra Linear algebra performance Must go faster

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants