DIP56 Provide pragma to control function inlining
Andrei Alexandrescu
SeeWebsiteForEmail at erdani.org
Sun Feb 23 20:25:43 PST 2014
On 2/23/14, 6:05 PM, Walter Bright wrote:
> 4. I don't see that users really are asking for inlining or not. They
> are asking for the fastest code. As such, providing hints about usage
> frequencies are entirely appropriate. Micromanaging the method used is
> not so appropriate. After all, the reason one uses a compiler in the
> first place rather than assembler is to not micromanage the actual
> instructions.
In HHVM we plainly ask for specific decisions on inlining or not. We
have a reasonably good understanding of how and where our code has
trouble with ICache misses, and adjust our inline decisions and validate
using experiments.
A decision to force inlining or against it already indicates a failure
of the compiler's heuristics to address the situation. Keeping it an
option is insisting on failing.
> Perhaps the lesson is the word 'inline' carries certain expectations
> with it, and the feature would be better positioned as something like:
>
> pragma(usage, often);
> pragma(usage, rare);
That's an interesting unrelated idea. But if we defined pragmas to
"force inline" and "never inline" we must damn sure make sure the
compiler always does that. It's "listen to your customers" as plainly as
it gets.
Andrei
More information about the Digitalmars-d
mailing list