Skip to content

Remove more bounds checks#661

Merged
ViralBShah merged 2 commits intoJuliaSparse:mainfrom
yuyichao:yyc/inbounds
Dec 20, 2025
Merged

Remove more bounds checks#661
ViralBShah merged 2 commits intoJuliaSparse:mainfrom
yuyichao:yyc/inbounds

Conversation

@yuyichao
Copy link
Copy Markdown
Contributor

Mostly for nzrange but also added more @inbounds as I went through the files. All of the functions that has additional @inbounds either takes no user index input or have already performed explicit checks on the index (e.g. isstored).

@codecov
Copy link
Copy Markdown

codecov bot commented Dec 20, 2025

Codecov Report

❌ Patch coverage is 98.07692% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 84.18%. Comparing base (8b03562) to head (7c39af1).
⚠️ Report is 2 commits behind head on main.

Files with missing lines Patch % Lines
src/linalg.jl 97.14% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #661      +/-   ##
==========================================
+ Coverage   84.15%   84.18%   +0.03%     
==========================================
  Files          12       12              
  Lines        9300     9301       +1     
==========================================
+ Hits         7826     7830       +4     
+ Misses       1474     1471       -3     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@ViralBShah
Copy link
Copy Markdown
Member

Does the @inbounds have measurable impact on performance? I guess there is no major challenge here since all the usage is safe.

@yuyichao
Copy link
Copy Markdown
Contributor Author

The inbounds on nzrange have measurable performance difference for small matrices (less than 10x10 and for about 10%). Definitely not for larger matrices. I did not benchmark the other functions.

@ViralBShah ViralBShah merged commit 4f25e13 into JuliaSparse:main Dec 20, 2025
10 checks passed
@dkarrasch
Copy link
Copy Markdown
Member

This was merged after the v1.13 split. Should this be backported?

@ViralBShah
Copy link
Copy Markdown
Member

Yes, we should backport this.

@ViralBShah ViralBShah added the backport 1.13 Change should be backported to release-1.13 label Dec 23, 2025
dkarrasch pushed a commit that referenced this pull request Dec 24, 2025
Mostly for `nzrange` but also added more `@inbounds` as I went through
the files. All of the functions that has additional `@inbounds` either
takes no user index input or have already performed explicit checks on
the index (e.g. `isstored`).
@dkarrasch dkarrasch mentioned this pull request Dec 24, 2025
4 tasks
dkarrasch added a commit that referenced this pull request Jan 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport 1.13 Change should be backported to release-1.13

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants