dmd codegen improvements

H. S. Teoh via Digitalmars-d digitalmars-d at puremagic.com
Fri Aug 21 08:33:52 PDT 2015


On Fri, Aug 21, 2015 at 03:09:42PM +0000, Ivan Kazmenko via Digitalmars-d wrote:
> On Friday, 21 August 2015 at 01:29:12 UTC, H. S. Teoh wrote:
> >On Fri, Aug 21, 2015 at 01:20:25AM +0000, jmh530 via Digitalmars-d wrote:
> >>On Friday, 21 August 2015 at 00:00:09 UTC, H. S. Teoh wrote:
> >>>
> >>>The gdc version, by contrast, inlines *everything*,
> >>
> >>This could be why I've observed performance differentials in dmd for
> >>doing some manual for loops rather than using the stuff in
> >>std.algorithms.
> >
> >Very likely, I'd say. IME dmd tends to give up inlining rather
> >easily.  This is very much something that needs to improve, since
> >ranges in D are supposed to be a big selling point. Wouldn't want
> >them to perform poorly compared to hand-written loops.
> 
> Yeah, ranges should ideally be a zero-cost abstraction, at least in
> trivial cases.

Definitely. Fortunately, gdc (and probably ldc) seems quite capable of
achieving this. It's just dmd that needs some improvement in this area.
This will quickly become a major issue once we switch to ddmd and start
making use of range-based code in the compiler, esp. since compiler
performance has been one of the selling points of D.


T

-- 
Democracy: The triumph of popularity over principle. -- C.Bond


More information about the Digitalmars-d mailing list