-
-
Notifications
You must be signed in to change notification settings - Fork 35
Closed
Labels
sparseSparse arraysSparse arrays
Description
Take this simple code:
using BenchmarkTools
n = 10^7
M = convert(SparseMatrixCSC{UInt32, UInt32}, round.(10*sprand( n, n, 4*1/n)))
v = ones(UInt32, n)
@benchmark M*v
At this point M has the following property.:
10000000×10000000 SparseMatrixCSC{UInt32,UInt32} with 37999566 stored entries
The computation M*v should take exactly 37,999,566 multiplications and no more than that number of additions.
BenchmarkTools.Trial:
memory estimate: 38.15 MiB
allocs estimate: 2
--------------
minimum time: 760.211 ms (0.00% GC)
median time: 760.683 ms (0.00% GC)
mean time: 762.270 ms (0.00% GC)
maximum time: 766.944 ms (0.00% GC)
--------------
samples: 7
evals/sample: 1
This seems slower than I expected given the number of multiplications and additions.
Is the problem the CSC format of the matrix? Would it be faster if M were in CSR format?
logankilpatrick
Metadata
Metadata
Assignees
Labels
sparseSparse arraysSparse arrays