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

Improve performance with METH_FASTCALL #59

Closed
SethMMorton opened this issue Jan 27, 2023 · 0 comments
Closed

Improve performance with METH_FASTCALL #59

SethMMorton opened this issue Jan 27, 2023 · 0 comments

Comments

@SethMMorton
Copy link
Owner

Starting in Python 3.7, there is a new way for C functions to define how arguments are passed from python called "fast call" or "vector call" that is supposed to be much faster than the standard method. Taking advantage of this should provide a performance boost for fastnumbers.

Unfortunately, there is as-of-yet no public API for parsing arguments when using this method, so I will have to write one. I will likely heavily borrow from numpy/numpy#15269.

SethMMorton added a commit that referenced this issue Jan 30, 2023
This uses the "vector call" functionality to call C functions. It
requires fewer memory allocations by Python to call the function and
thus is a bit faster. Unsurprisingly, this gave a 1-2 microsecond
speedup across the board in the performance tests I ran.

Unfortunately, Python does not ship a parser for this, so I adapted the
parser from the numpy project.

This closes #59.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant