-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
performance regression for the product between a sparse matrix and a BitArray. #28011
Comments
It looks like the requisite sparse optimization methods are still there, but they're not layering into the dispatch tables appropriately. We have a Edit: interestingly, both of these methods existed in 0.6 (named |
Shouldn't that raise an ambiguity error? |
Possibly relevant: #27408 |
With version 0.7.0-beta2.12 (2018-07-15 15:57 UTC, Commit a878341) I get the following results from btime:
The runtime seems to scale like n² in 0.7.0-beta2.12 while it scales like n in Julia 0.6.4. |
Oh, duh. Thanks. Looks like we need to add generic implementations, then… or it may be possible that the strided implementations don't actually require stridedness. |
Here are some updated benchmarks if it is helpful (on a difference machine): in Julia 1.1:
In julia 0.6.4:
The performance problem is still there. |
I've put this on the 1.2 milestone—this should really be addressed as it's a huge regression. It's bad enough that a simple, low-risk fix would be a candidate for backporting to 1.1 and maybe even 1.0. |
So the sparse implementations can totally be widened to Unfortunately that rapidly lands you in ambiguity hell. |
I'm moving this away from the milestone. While it is a regression, it occurred in 0.7 and I don't think it should block 1.2. |
I observe on 1.3 master:
Please reopen if still an issue. |
For your information, it seems that sparse arrays times a bit array uses the generic matmul, while sparse arrays times a boolean array uses the sparse matrix multiplication. julia> @btime sparse(1.0I,n,n) * trues(n);
10.693 ms (7 allocations: 32.09 KiB)
julia> @btime sparse(1.0I,n,n) * ones(Bool,n);
8.331 μs (6 allocations: 32.92 KiB) For me, it is quite easy to use boolean arrays instead of bit arrays, but I did not expect this difference in run-time (also julia 1.3.0, Linux). |
BitArrays are slow to index so a vector of bools would likely still till be faster. |
Ok, thanks for the information!😀 |
In Julia 0.7.0-beta.206 I see a performance regression relative to Julia 0.6.3 for a production between a sparse matrix and a BitArray. This regression does not affect arrays created by e.g.
ones(Bool,n)
, just BitArrays. It seems that the sparse matrix is transformed into a full matrix.33.780663 seconds (116.22 M allocations: 2.102 GiB, 0.36% gc time)
julia 0.6.3:
0.000031 seconds (14 allocations: 32.313 KiB)
The text was updated successfully, but these errors were encountered: