Skip to content
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

isequal very slow for SparseVectors #561

Open
dpinol opened this issue Sep 30, 2024 · 0 comments
Open

isequal very slow for SparseVectors #561

dpinol opened this issue Sep 30, 2024 · 0 comments

Comments

@dpinol
Copy link
Contributor

dpinol commented Sep 30, 2024

It looks like isequal(SparseVector) loops along all dimensions instead of only the non zero ones.
Comparing 2 instances which just contain 1 value take 1.5s

julia> using SparseArrays

julia> const v=spzeros(1000_000_000)
1000000000-element SparseVector{Float64, Int64} with 0 stored entries

julia> const v2=spzeros(1000_000_000)
1000000000-element SparseVector{Float64, Int64} with 0 stored entries

julia> v[1]=1
1

julia> v2[1]=1
1

julia> @time isequal(v,v2);
  1.510852 seconds

julia> @time isequal(v,v2);
  1.503675 seconds
julia> versioninfo()
Julia Version 1.11.0-rc4
Commit b4b9add84db (2024-09-25 11:03 UTC)
Build Info:
  Official https://julialang.org/ release
Platform Info:
  OS: Linux (x86_64-linux-gnu)
  CPU: 32 × 13th Gen Intel(R) Core(TM) i9-13950HX
  WORD_SIZE: 64
  LLVM: libLLVM-16.0.6 (ORCJIT, alderlake)
Threads: 1 default, 0 interactive, 1 GC (on 32 virtual cores)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant