Force inline

ketmar via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Mon Feb 20 05:48:30 PST 2017


Moritz Maxeiner wrote:

> I don't know, but I'd guess that the length of a function is not as 
> important for the consideration of being inlined as its semantics.
yep. basically, dmd doesn't like anything other than very simple 
if/else conditions. sometimes it likes

  if (cond0) return n0; else if (cond1) return n1; ...

more than the same code without else.

don't even try to inline loops. ;-)

anyway, in my real-life code inlining never worth the MASSIVELY 
increased compile times: speedup is never actually noticeable. if 
"dmd -O" doesn't satisfy your needs, there is usually no reason to 
trying "-inline", it is better to switch to ldc/gdc.


More information about the Digitalmars-d-learn mailing list