Skip to content

Get rid of inefficient findnz#111

Merged
gdalle merged 2 commits intomainfrom
gd/no_findnz
Sep 26, 2024
Merged

Get rid of inefficient findnz#111
gdalle merged 2 commits intomainfrom
gd/no_findnz

Conversation

@gdalle
Copy link
Copy Markdown
Member

@gdalle gdalle commented Sep 26, 2024

Replace every occurrence of I, J, _ = findnz(S) with the non-allocating iteration:

rv = rowvals(S)
for j in axes(S, 2)
    for k in nzrange(S, j)
        i = rv[k]
        # do stuff
    end
end

@codecov
Copy link
Copy Markdown

codecov Bot commented Sep 26, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 100.00%. Comparing base (e26edfe) to head (f30f5be).
Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff            @@
##              main      #111   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           10        10           
  Lines          755       764    +9     
=========================================
+ Hits           755       764    +9     

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

@gdalle gdalle merged commit cbce39f into main Sep 26, 2024
@gdalle gdalle deleted the gd/no_findnz branch September 26, 2024 09:15
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

Successfully merging this pull request may close these issues.

1 participant