Problems with dmd inlining

Andrei Alexandrescu SeeWebsiteForEmail at erdani.org
Sat Dec 11 20:43:31 PST 2010


On 12/11/10 10:36 PM, Brad Roberts wrote:
> On 12/11/2010 8:22 PM, Craig Black wrote:
>> I did some benchmarking with a simple quick sort algorithm and was very
>> disappointed that dmd was over twice as slow as Visual C++.  Investigation
>> revealed most of the slowness was due to the fact that dmd was not inlining a
>> simple function that returned a reference.  After hand-inlining some code, I got
>> within 20% of the performance of Visual C++.  I don't see this as acceptable.
>> The main reason that I want to use D is so that my code will be cleaner.  If I
>> have to inline my own functions then this will not result in clean code.
>>
>> Anyway, has anyone else had problems with dmd's inliner?  Should I post a bug
>> report or has someone else already complained about this?
>>
>> -Craig
>
> There's a number of things that currently stop dmd from inlining.  Several exist
> as bug reports.  I don't recall if there's one about ref return results or not.
>   These limitations are certainly worth working to lift, but they're lower
> priority than a lot of other bugs.  That said, they're the sort of thing I enjoy
> trying to fix, so go ahead and file a nice tiny test case.
>
> As always, if there's issues you care a lot about, the source code for the
> compiler is there for anyone to work with.
>
> Later,
> Brad

Seconded. I think it's great to address whatever keeps bona fide 
potential users from using D over competitor languages.

One more thing - to clarify, Craig, are you implying that it's 
acceptable for performance to be within 20%? If not, there are tweaks on 
the algorithmic side we can do to improve sorting.


Andrei


More information about the Digitalmars-d mailing list