Skip to content

perf: improve single point transform and remove warning from numpy scalars - #1616

Merged
snowman2 merged 1 commit into
pyproj4:mainfrom
greglucas:perf-single-point
Aug 10, 2026
Merged

perf: improve single point transform and remove warning from numpy scalars#1616
snowman2 merged 1 commit into
pyproj4:mainfrom
greglucas:perf-single-point

Conversation

@greglucas

Copy link
Copy Markdown
Contributor

Change from a try/except raise case for numpy array vs scalar checking to a _is_scalar check 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).

@snowman2 snowman2 added this to the 3.8.0 milestone Aug 9, 2026
Comment thread pyproj/geod.py
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.
@snowman2
snowman2 merged commit 34af5f6 into pyproj4:main Aug 10, 2026
8 of 20 checks passed
@snowman2

Copy link
Copy Markdown
Member

Thanks @greglucas 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Remove special-case casting support for numpy<2.0

2 participants