inlining...

bearophile bearophileHUGS at lycos.com
Fri Mar 14 05:08:04 PDT 2014


John Colvin:

> Another use case is to aid propogation of compile-time 
> information for optimisation.
> A function might look like a poor candidate for inlining for 
> other reasons, but if there's a statically known (to the 
> caller) integer parameter coming in that will be used to decide 
> a loop length, inlining allows that info to be propogated to 
> the callee. Static loop lengths => well optimised loops, with 
> opportunities for optimal unrolling. Even with quite a large 
> function this can be a good choice to inline.

If the function is private in a module, and it's called only from 
one point (or otherwise the loop count is the same in different 
calls), I think this optimization can be performed even if the 
function is not inlined.

Bye,
bearophile


More information about the Digitalmars-d mailing list