Fix Cython warnings by svank · Pull Request #418 · astropy/reproject · GitHub
Skip to content

Fix Cython warnings#418

Merged
astrofrog merged 2 commits into
astropy:mainfrom
svank:cython-warnings
Nov 28, 2023
Merged

Fix Cython warnings#418
astrofrog merged 2 commits into
astropy:mainfrom
svank:cython-warnings

Conversation

@svank

@svank svank commented Nov 28, 2023

Copy link
Copy Markdown
Contributor

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

codecov Bot commented Nov 28, 2023

Copy link
Copy Markdown

@astrofrog astrofrog merged commit ae804ad into astropy:main Nov 28, 2023
@astrofrog

Copy link
Copy Markdown
Member

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