Subject: Re: [boost] BOOST_FORCE_INLINE
From: Thorsten Ottosen (thorsten.ottosen_at_[hidden])
Date: 2011-10-10 04:47:19
Den 10-10-2011 08:22, Jeffrey Lee Hellrung, Jr. skrev:
> On Sun, Oct 9, 2011 at 6:08 PM, Beman Dawes<bdawes_at_[hidden]> wrote:
>> Shouldn't there be documentation that describes when to use it and
>> when not to use it? I guess my main concern is that it might be used
>> inappropriately if the name is the only guideline developers have.
> +1, my thoughts exactly, Beman. Can anyone provide any links to a case
> study or something similar investigating the effects of forcing inlining?
> I'm definitely interested to see what real effects this could have.
I don't have a link, but can talk a little about my experience.
I was trying to optimize some of our performance critical code.
Step one is to find the bottlenecks with some tool. I used the one that
comes with visual C++.
After running this, I had a great overview over which functions took up
most of the time, and which functions that were called a lot (say, many
million times). Usually,
the compiler will not inline a large function because the saved time is
neglible and more code is generated. However, the compiler can usually
not know that a large function often returns quickly where large parts
of the code of the function is only used sometimes.
Hence I used __force_inline.
I do think, from an optimization point of view, that it is /not/ an
optimal/complete solution. It would often be better to request at a
call-site that the function should be inline here, and only here.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk