Problems with dmd inlining

Jason House jason.james.house at gmail.com
Sat Dec 11 21:59:45 PST 2010


Jason House Wrote:

> Craig Black Wrote:
> 
> > > 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.
> > 
> > 20% slower would be acceptable if I didn't have to do my own inlining. 
> > Closing the gap even more would be nice.  Twice as slow is not acceptable.
> > 
> > -Craig 
> 
> I wish I had your problems. I ported a sizable set of C++ code to D2 and discovered D2 with dmd was 50x slower than C++ with gcc! I've been to busy/disappointed to track down the bug(s) causing such a slowdown. If anyone is sufficiently inspired to find the bugs, I can make the GPL source code available.

I should add that I strongly suspect failure to inline as a cause. The C++ code has lots of mini functions returning compile-time constants. I know that the C++ code started out as low level code aimed at maximum performance and then gradually got cleaned up. Any cleanup that confused gcc's optimizer was rejected/reworked. The code may be closely tied to gcc's optimization/inlining, but dmd should come close. 20% slower would be acceptable.


More information about the Digitalmars-d mailing list