inlining or not inlining...

Walter Bright newshound2 at digitalmars.com
Fri Feb 11 00:37:56 PST 2011


so wrote:
>> While in isolation that's a good idea, how far should it be taken? 
>> Should the compiler emit information on which variables wound up in 
>> which registers, and why? What about other of the myriad of compiler 
>> optimizations?
> 
> Isn't Inlining by far the most important (most practical) optimization 
> among those that actually we can control?

No, not even close. The first step is figure out where your program is slow, and 
then why it is slow. For example, if it is slow because foo() is being called 
1,000,000 times, you'll get a one thousand times speedup if you can tweak your 
algorithms so that it is only called 1,000 times.


> A few times i have seen comparisons here to similar languages and in 
> most of them the inlining was the reason (only) for the inferior 
> performance.
> I agree it would be awesome if the compilers had the ability to chose 
> the best method, but comparisons show sometimes the opposite, i don't 
> know maybe they are hand-picked for some reason.

Certainly, the inliner in dmd can be improved.


More information about the Digitalmars-d mailing list