perf: improve single point transform and remove warning from numpy scalars - #1616
Merged
Conversation
snowman2
reviewed
Aug 9, 2026
Change from a try/except raise case to is_scalar check that also removes the numpy warning cases without any cutout needed for numpy specifically.
greglucas
force-pushed
the
perf-single-point
branch
from
August 9, 2026 18:44
f5f3dc2 to
49cb65d
Compare
Member
|
Thanks @greglucas 👍 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Change from a try/except raise case for numpy array vs scalar checking to a
_is_scalarcheck that also removes the numpy warning cases without any cutout needed for numpy specifically. This is both faster and cleaner. I think that before I was potentially trying two things that degraded performance:isinstance(x, numbers.Real)which goes back out to Python rather than Cython being able to check in C against float/int which we have now, and putting it after the type-cast cdef declarations (now the is_scalar check comes before that).history.rstfor all changes andapi/*.rstfor new API