On Thu, Sep 08, 2016 at 04:37:36PM +0000, Stefan Koch via Digitalmars-d wrote: [...] > Also we need to special case ranges in general. > And try harder to inline calls to range functions. > Maybe even early in the frontend. [...]
Yeah, dmd's inliner is really pessimistic. It gives up too easily, and as a result often misses a whole series of further opportunities that could have opened up, had it decided to inline. Having range-specific optimizations is a good idea, I think. Since it's one of D's big selling points, it needs to be as high-performance as we can possibly make it. I think there is a lot we can do in this area that we can't do as general optimizations; range-based code has certain recurring structures that should be highly-exploitable in terms of optimization opportunities. IME I've found that GDC is much better at optimizing range-based code because of its aggressive inliner (and also better loop optimization algorithms); but there's probably still room for range-specific optimizations that a general optimizer like the gcc backend wouldn't have. T -- Democracy: The triumph of popularity over principle. -- C.Bond