Calling a function has a certain overhead. Registers must be saved, a new stack frame pushed,… For small functions this overhead is more than the actual implementation of the function!
For those, it is much better if the compiler would copy-paste the implementation directly into the call site. This is what inlining does.
Luckily, the compiler is usually able to do this optimization. Or can it?
In this series, I’ll explain my changes and share some lessons about optimization I’ve learned in the process of beating Boost.Pool. This time I’m going to cover inlining. I’m going to share some of guidelines I’ve learned and also going to give you a look into some of memory`s internal code and design.» read more »