Michael Nicolella wrote:
Why don't you trust your compiler to decide when inlining a function is a good choice for an optimization? :)
I have analyzed the assembler output of the most performance critical part of the project and figured out that inlining some functions will lead to better code. Note that the creators of GCC and MSVC have made the forceinline options because they know that the compiler is not always able to make a good decision about inlining. This options are provided to enable the user to guide the compiler optimizations. It is not that you gain much from the inlining of functions by getting rid of extra function calls. It is that inlining enables other optimization possibilities. For instance, constant folding cannot be performed before the function returning a constant is inlined.