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

make rust function benchmarks more similar to the Python ones #2896

Merged
merged 2 commits into from
Jan 20, 2023

Conversation

davidhewitt
Copy link
Member

We have some benchmarks in pytests/tests/test_pyfunctions.py which I occasionally peek at, which compares some #[pyfunction] performance with pure-Python equivalents. It's designed purely to measure the overheads.

The existing comparison wasn't exactly fair because it used Rust types such as i32 on the Rust side, meaning there was additional runtime type checking going on compared to the Python implementations.

I've removed that in this PR, making all the input types on the Rust side just &PyAny or Option<&PyAny>. This does reduce the gap between the Python and Rust ones where we're slower, however it shows there is still some wins we could yet find in overhead reduction.

@davidhewitt davidhewitt added the CI-skip-changelog Skip checking changelog entry label Jan 20, 2023
@davidhewitt
Copy link
Member Author

bors r=adamreichold

@bors
Copy link
Contributor

bors bot commented Jan 20, 2023

Build succeeded:

@bors bors bot merged commit 18081ba into PyO3:main Jan 20, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CI-skip-changelog Skip checking changelog entry
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants