astropy / reproject

Python-based Astronomical image reprojection :milky_way: - maintainer @astrofrog
https://reproject.readthedocs.io
BSD 3-Clause "New" or "Revised" License
105 stars 64 forks source link

Fix Cython warnings #418

Closed svank closed 7 months ago

svank commented 7 months ago

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

codecov[bot] commented 7 months ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

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

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

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

astrofrog commented 7 months ago

Thanks!