Skip to content

[BUG] *(block sparse, dense) (and vice versa) is slow #197

Description

@xuanzhaogao

I found that even with an empty BlockSparseArray, doing a matrix vector mul is slow and causes large allocations. Is this expected behavior?

julia> using BlockArrays, BlockSparseArrays

julia> using BenchmarkTools

julia> cnt = fill(16, 128);

julia> bsa = BlockSparseArray{T}(undef, cnt, cnt);

julia> o = ones(2048);

julia> @benchmark $(bsa) * $(o)
BenchmarkTools.Trial: 4 samples with 1 evaluation per sample.
 Range (min  max):  1.603 s    1.627 s  ┊ GC (min  max): 21.85%  21.13%
 Time  (median):     1.613 s              ┊ GC (median):    21.64%
 Time  (mean ± σ):   1.614 s ± 10.349 ms  ┊ GC (mean ± σ):  21.63% ±  0.36%

  █          █                      █                     █
  █▁▁▁▁▁▁▁▁▁▁█▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁█▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁█ ▁
  1.6 s          Histogram: frequency by time        1.63 s <

 Memory estimate: 17.06 GiB, allocs estimate: 29376515.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions