◐ Shell
clean mode source ↗

bpo-45116: Add the Py_ALWAYS_INLINE macro by vstinner · Pull Request #28390 · python/cpython

Conversation

@vstinner

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

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
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

PR rebased to retrieve the Windows build fix.

erlend-aasland

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about a What's New entry?

@vstinner

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 ;-)

niyas-sait pushed a commit to niyas-sait/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.

@neonene neonene mannequin mentioned this pull request

Apr 10, 2022