Inline Functions

Jarrett Billingsley jarrett.billingsley at gmail.com
Wed Feb 25 18:17:09 PST 2009


On Wed, Feb 25, 2009 at 8:59 PM, Walter Bright
<newshound1 at digitalmars.com> wrote:
> Jarrett Billingsley wrote:
>>
>> Also, looking at the DMD frontend source is *not* an acceptable option.
>
> I knew you'd say that <g>.

I knew you'd suggest it ;)

> On the other hand, inlining or not is, like register allocation and any
> other optimizations, highly implementation dependent. If you're going to
> micro-optimize at that level, it really is worthwhile to get familiar with
> obj2asm and the relevant compiler source code.

True.  However defining what the compiler does in these optimizations
is not just in the interest of performance, but also in the interest
of correctness and other implementations.  If everyone can see what
DMD is and isn't inlining, they can ask "why" or "why not"; they can
correct you if you make a mistake; they can suggest optimizations you
might not have thought of; and they can see optimizations that fall
out as a consequence of the language that they might not have
considered when making their own compiler.

Furthermore things like NRVO either need to be specified in the
language or specified in the ABI.  You told me before that static
opCall for structs is just as efficient as constructors because of
NRVO; I didn't and still don't buy it for exactly the reasons you just
now gave: optimizations are highly implementation-dependent.  It's
this kind of stuff that needs to be specified: is NRVO required, or
just _really really nice to have_?  Insert many other optimizations
here.



More information about the Digitalmars-d mailing list