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

faster cat performance #432

Merged
merged 1 commit into from
Sep 1, 2023
Merged

faster cat performance #432

merged 1 commit into from
Sep 1, 2023

Conversation

vtjnash
Copy link
Contributor

@vtjnash vtjnash commented Aug 31, 2023

The generic cat does more shape analysis, that typed_cat does not always do (before either may then dispatch to _cat_t), so we can make this faster by calling it instead.

Secondly, we can make issparse non-recursive once it hits a base case where all trailing elements are the same. This makes it much better at handling large splat, since we do not need to check each recursively smaller type down to the base case using generic code, and just generate one const method specialized on the full length instead.

Fix JuliaLang/julia#51011

The generic `cat` does more shape analysis, that typed_cat does not
always do (before either may then dispatch to _cat_t), so we can make
this faster by calling it instead.

Secondly, we can make `issparse` non-recursive once it hits a base case
where all trailing elements are the same. This makes it much better at
handling large splat, since we do not need to check each recursively
smaller type down to the base case using generic code, and just generate
one const method specialized on the full length instead.

Fix JuliaLang/julia#51011
@vtjnash vtjnash added the merge me Merge when all tests are passing label Aug 31, 2023
@codecov
Copy link

codecov bot commented Aug 31, 2023

Codecov Report

Merging #432 (6d75f1e) into main (54f4b39) will increase coverage by 0.00%.
The diff coverage is 100.00%.

@@           Coverage Diff           @@
##             main     #432   +/-   ##
=======================================
  Coverage   92.42%   92.42%           
=======================================
  Files          12       12           
  Lines        7666     7667    +1     
=======================================
+ Hits         7085     7086    +1     
  Misses        581      581           
Files Changed Coverage Δ
src/sparsevector.jl 95.46% <100.00%> (+<0.01%) ⬆️

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@KristofferC KristofferC merged commit 4e6776a into main Sep 1, 2023
9 checks passed
@KristofferC KristofferC deleted the jn/cat-51011 branch September 1, 2023 07:36
matbesancon pushed a commit to matbesancon/SparseArrays.jl that referenced this pull request Sep 3, 2023
The generic `cat` does more shape analysis, that typed_cat does not
always do (before either may then dispatch to _cat_t), so we can make
this faster by calling it instead.

Secondly, we can make `issparse` non-recursive once it hits a base case
where all trailing elements are the same. This makes it much better at
handling large splat, since we do not need to check each recursively
smaller type down to the base case using generic code, and just generate
one const method specialized on the full length instead.

Fix JuliaLang/julia#51011
vtjnash added a commit that referenced this pull request Sep 5, 2023
The generic `cat` does more shape analysis, that typed_cat does not
always do (before either may then dispatch to _cat_t), so we can make
this faster by calling it instead.

Secondly, we can make `issparse` non-recursive once it hits a base case
where all trailing elements are the same. This makes it much better at
handling large splat, since we do not need to check each recursively
smaller type down to the base case using generic code, and just generate
one const method specialized on the full length instead.

Fix JuliaLang/julia#51011

(cherry picked from commit 4e6776a)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
merge me Merge when all tests are passing
Projects
None yet
Development

Successfully merging this pull request may close these issues.

using SparseArrays makes vcat'ing adjoint vectors memory hog, regression in Julia 1.10 beta
2 participants