(un)-force-inline helper - (Fastware 2014 - Andrei)
Optimization Tips - Mo’ Hustle Mo’ Problems - CppCon 2014
- Smarter C/C++ inlining with
__attribute__((flatten))
Options That Control Optimization
- An interesting bechmark: always_inline performance. - SO
- -foptimize-sibling-calls - Optimize sibling and tail recursive calls.
- -finline-small-functions -
- -findirect-inlining
- -finline-functions - Consider all functions for inlining, even if they are not declared inline.
- -fearly-inlining - Inline functions marked by always_inline and functions whose body seems smaller than the function call overhead
- -finline-limit=n - This flag allows coarse control of this limit. n is the size of functions that can be inlined in number of pseudo instructions.
- -fwhole-program - Assume that the current compilation unit represents the whole program being compiled.
Common Function Attributes (GCC)
- __cold__ - The cold attribute on functions is used to inform the compiler that the function is unlikely to be executed.
- __hot__ - The hot attribute on a function is used to inform the compiler that the function is a hot spot of the compiled program.
- __leaf__ - Calls to external functions with this attribute must return to the current compilation unit only by return or by exception handling. For example, the sin function is a leaf function, but qsort is not.
- __pure__ - Calls to functions that have no observable effects on the state of the program other than to return a value may lend themselves to optimizations such as common subexpression elimination.
Written on February 17, 2019, Last update on May 30, 2021
c++
fastware
inline