Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
SparseArrays: specialize zero(...) so result has nnz(...) = 0 (#34209)
Before this commit, the result of zero(x::AbstractSparseArray) is filled with stored zeros exactly where `x` has a stored value. That is a wasteful artifact of the default fallback implementation for `AbstractArray`. After this commit, we return a sparse array of the same dimensions as `x` without any stored values. This change is backwards incompatible where it relates to object identity. Before this commit, for mutable objects, every stored zero has the same identity. Example: julia> using SparseArrays julia> y = zero(BigInt[1,2,3]); y[1] === y[2] true julia> y = zero(sparse(BigInt[1,2,3])); y[1] === y[2] true julia> Base.zero(a::AbstractSparseArray) = spzeros(eltype(a), size(a)...) julia> y = zero(sparse(BigInt[1,2,3])); y[1] === y[2] false But this behaviour should be classified as a performance bug and can therefore be fixed in a minor (but not a patch) release.
- Loading branch information
0570202
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Executing the daily benchmark build, I will reply here when finished:
@nanosoldier
runbenchmarks(ALL, isdaily = true)
0570202
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Executing the daily package evaluation, I will reply here when finished:
@nanosoldier
runtests(ALL, isdaily = true)
0570202
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Your benchmark job has completed - possible performance regressions were detected. A full report can be found here. cc @ararslan
0570202
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Your test job has completed - possible new issues were detected. A full report can be found here. cc @maleadt