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

Enhance _iter_comparable loop #465

Closed
wants to merge 0 commits into from

Conversation

Vincent-Maladiere
Copy link
Contributor

@Vincent-Maladiere Vincent-Maladiere commented Jul 3, 2024

Checklist

  • pytest passes
  • code is well formatted

What does this implement/fix? Explain your changes
Hello @sebp!

The sksurv.metrics._iter_comparable function repeatedly creates a mask using np.zero, but this mask doesn't change for different elements j of the loop. Mallocs are computationally expensive, so this short PR proposes to reduce the number of calls to np.zero by creating the mask before the for-loop.

This will help make the c_index functions more efficient. WDYT?

cc @ogrisel

Copy link

codecov bot commented Jul 3, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 98.15%. Comparing base (03566f6) to head (2de9df5).

Additional details and impacted files
@@           Coverage Diff           @@
##           master     #465   +/-   ##
=======================================
  Coverage   98.15%   98.15%           
=======================================
  Files          37       37           
  Lines        3526     3526           
  Branches      539      539           
=======================================
  Hits         3461     3461           
  Misses         31       31           
  Partials       34       34           

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

Copy link

Coverage summary from Codacy

See diff coverage on Codacy

Coverage variation Diff coverage
+0.00%
Coverage variation details
Coverable lines Covered lines Coverage
Common ancestor commit (03566f6) 3526 3495 99.12%
Head commit (03566f6) 3526 (+0) 3495 (+0) 99.12% (+0.00%)

Coverage variation is the difference between the coverage for the head and common ancestor commits of the pull request branch: <coverage of head commit> - <coverage of common ancestor commit>

Diff coverage details
Coverable lines Covered lines Diff coverage
Pull request (#465) 0 0 ∅ (not applicable)

Diff coverage is the percentage of lines that are covered by tests out of the coverable lines that the pull request added or modified: <covered lines added or modified>/<coverable lines added or modified> * 100%

See your quality gate settings    Change summary preferences


🚀 Don’t miss a bit, follow what’s new on Codacy.

Codacy stopped sending the deprecated coverage status on June 5th, 2024. Learn more

sebp added a commit that referenced this pull request Jul 3, 2024
@sebp
Copy link
Owner

sebp commented Jul 3, 2024

Thanks a lot for the PR.

Sorry for initially messing up your commit, but it's merged with commit ecd6dad now.

@Vincent-Maladiere
Copy link
Contributor Author

Awesome, thanks!

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.

2 participants