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

bpo-45116: Add the Py_ALWAYS_INLINE macro #28390

Merged
merged 3 commits into from Sep 17, 2021

Conversation

vstinner
Copy link
Member

@vstinner vstinner commented Sep 16, 2021

Add the Py_ALWAYS_INLINE macro to ask the compiler to always inline a
static inline function. The compiler can ignore it and decides to not
inline the function.

https://bugs.python.org/issue45116

@vstinner
Copy link
Member Author

vstinner commented Sep 16, 2021

I decided to split my old PR #28141 in two parts:

  • (1) this PR adds the macro
  • (2) use the macro on some performance critical static inline functions

vstinner added 3 commits Sep 16, 2021
Add the Py_ALWAYS_INLINE macro to ask the compiler to always inline a
static inline function. The compiler can ignore it and decides to not
inline the function.
@vstinner
Copy link
Member Author

vstinner commented Sep 16, 2021

PR rebased to retrieve the Windows build fix.

Copy link
Contributor

@erlend-aasland erlend-aasland left a comment

How about a What's New entry?

@vstinner vstinner merged commit 6b41355 into python:main Sep 17, 2021
12 checks passed
@vstinner vstinner deleted the add_always_inline branch Sep 17, 2021
@vstinner
Copy link
Member Author

vstinner commented Sep 17, 2021

How about a What's New entry?

I don't want to advertise too much this macro :-D As I wrote in its documentation, misusing it can make the code slower.

Also, I'm not even sure if it should be used in Python :-) Benchmarks will give us some hints ;-)

nsait-linaro pushed a commit to nsait-linaro/cpython that referenced this pull request Sep 21, 2021
Add the Py_ALWAYS_INLINE macro to ask the compiler to always inline a
static inline function. The compiler can ignore it and decides to not
inline the function.
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.

None yet

4 participants