Inlining method can help to mitigate the following:
- Function call overhead;
- Pipeline stall.
It is advised to apply the method for the following types of routines:
- Trivial and small functions used as accessors to data or wrappers around another function;
- Big functions called quite regularly but not from many places.
A modern compiler uses heuristics to decide which functions need to be inlined. But it is always better to give it a hint using the following keywords.
Moreover to make a decision instead of the gcc compiler the following attribute should be used.