DIP56 Provide pragma to control function inlining

Dmitry Olshansky dmitry.olsh at gmail.com
Sun Feb 23 13:04:49 PST 2014


24-Feb-2014 00:46, Walter Bright пишет:
> On 2/23/2014 5:07 AM, Dmitry Olshansky wrote:
>> Part of the reason for forced inline is always inlining some core
>> primitives,
>> even in debug builds.
>
> Right - and if the compiler won't do it, how does the error message help?
>
That programmer is instantly aware that it can't be done due to some 
reason. Keep in mind that code changes with time and running 
profiler/disassembler on every tiny change to make sure the stuff is 
still inlined is highly counter-productive.

>  > I wouldn't not like to ever have to get down and look at ASM for
> every function just to make sure it was inlined.
>
> By the time you get to the point of checking on inlining, you're already
> looking at the assembler output, because the function is on the top of
> the profile of time wasters, and that's how you take it to the next
> level of performance.

A one-off activity. Now what guarantees you will have that it will keep 
getting inlined? Right, nothing.
>
> The trouble with an error message, is what (as the user) can you do
> about it?

Re-write till compiler loves it, that is what we do today anyway. Else 
we wouldn't mark it as force_inline in the first place.

With error - yo get a huge advantage - an _instant_ feedback that it 
doesn't do what you want it to do. Otherwise it gets the extra pleasure 
of running disassembler to pinpoint your favorite call sites or 
observing that your profiler shows the same awful stats.

-- 
Dmitry Olshansky


More information about the Digitalmars-d mailing list