inlining or not inlining...

Brad Roberts braddr at puremagic.com
Fri Feb 11 00:50:54 PST 2011


On 2/11/2011 12:37 AM, Walter Bright wrote:
> 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.

Improving the inline is one of the many itches I intend to scratch at some point.  I did some a while back to get my
feet wet.  I'll get back to it again at some point.  Currently it only does the really easy stuff, and that's clearly
not good enough in the long run.


More information about the Digitalmars-d mailing list