So why doesn't popFront return an element?

Jonathan M Davis jmdavisProg at gmx.com
Thu Apr 14 10:29:37 PDT 2011


> On Thu, 14 Apr 2011 12:57:10 -0400, Andrej Mitrovic
> 
> <andrej.mitrovich at gmail.com> wrote:
> > This leads me to another question I've always wanted to ask. A call such
> > as:
> > 
> > auto b=map!foo(map!bar1(map!bar2(a));
> > 
> > This constructs a lazy range. What I'm wondering is if there are any
> > performance issues when constructing long chains of ranges like that,
> > since this basically routes one function to the next, which routes to
> > the next
> 
> Of course. Ranges are very dependent on inlining for their performance
> benefit. Which means you are depending on the compiler inlining the code
> in order to achieve good performance. The compiler doesn't always inline,
> and I'm not sure how deep it can go.

IIRC, I believe that I brought that up at one point and Walter said that it 
could inline infinitely deep (assuming that that it makes sense of course). 
However, I don't think that there's much question that the inliner could be 
improved. If nothing else, there are too many things in the language which 
currently preclude inlining, and as I understand it, the inliner could use 
some work on how well it does at inlining what it does inline. But I haven't 
studied it, so I don't know how good it ultimately is.

- Jonathan M Davis


More information about the Digitalmars-d-learn mailing list