Boost logo

Boost Users :

From: Artem Alimarine (artem_at_[hidden])
Date: 2006-07-15 05:30:59


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.


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net