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

Fix Cython warnings #418

Merged
merged 2 commits into from
Nov 28, 2023
Merged

Fix Cython warnings #418

merged 2 commits into from
Nov 28, 2023

Conversation

svank
Copy link
Contributor

@svank svank commented Nov 28, 2023

Fixes #416

Implements Cython's suggested performance fixes and removes the "performance hint" warnings. Looks like new behavior in Cython 3.0, to ensure proper handling if a Python exception is raised within a function. Since these subroutines don't call any Python code directly, no Python exception can be raised, so we can add noexcept flags and avoid Cython checking for an exception after every function call. These changes gain a bit of speed in a real-world benchmark, but it looks like just speed that we lost when changing to Cython 3.

I also fixed a few warnings (removed an unused function, compiler worried about an uninitialized variable, explicitly set language_level to the new default, and added flag to not use the deprecated numpy api,) so now deforest.pyx builds without any warnings on my computer.

Performance of the adaptive code is indeed relevant to my interests---thanks for pointing this out, @astrofrog

Copy link

codecov bot commented Nov 28, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (b07fef5) 93.62% compared to head (117bdbc) 93.62%.

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #418   +/-   ##
=======================================
  Coverage   93.62%   93.62%           
=======================================
  Files          25       25           
  Lines         894      894           
=======================================
  Hits          837      837           
  Misses         57       57           

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

@astrofrog astrofrog merged commit ae804ad into astropy:main Nov 28, 2023
22 of 23 checks passed
@astrofrog
Copy link
Member

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.

Cython performance warnings in deforest.pyx
2 participants