-
-
Couldn't load subscription status.
- Fork 5.7k
Description
Constructing a large sparse matrix, using Int32 indices is a lot slower. Is this a performance bug or expected behavior? I kind of thought it would be quicker due to more elements being available in cache memory.
julia> N=1000000; NNZ=20*N;
julia> r = rand(int32(1:N),NNZ);
julia> c = rand(int32(1:N),NNZ);
julia> v = rand(Float32,NNZ);
julia> tic(); A = sparse(r,c,v,N,N); toc()
elapsed time: 11.829277923 seconds
11.829277923
julia> r = rand(int64(1:N),NNZ);
julia> c = rand(int64(1:N),NNZ);
julia> tic(); B = sparse(r,c,v,N,N); toc()
elapsed time: 6.594016314 seconds
6.594016314
julia> whos()
A 1000000x1000000 SparseMatrixCSC{Float32,Int32}
B 1000000x1000000 SparseMatrixCSC{Float32,Int64}