Overhauling the notion of output range

Andrei Alexandrescu SeeWebsiteForEmail at erdani.org
Mon Jul 12 12:03:56 PDT 2010


On 07/12/2010 01:31 PM, dsimcha wrote:
> But efficiency only matters some of the time, assuming the kind of inefficiency in
> question is small constant term inefficiency (as is the case here) and not O(N!)
> inefficiency or 1000-fold constant term inefficiency.

Historically the constant was large.

> Calling a delegate once per element is inefficient, but not **that** inefficient,
> and it's convenient at times, such as when the delegate will be used in contexts
> other than as an output range.  I think inefficiency is a poor excuse for not
> supporting this, and the users of Phobos should decide on a case-by-case basis
> whether calling a delegate for every element is efficient enough.

I guess that's fine, though I clearly recall that doFormat was, at the 
time I decided to rewrite it (2008 or so), virtually unusable for 
serious workloads. I don't know to what extent improvement in the 
compiler have eroded that margin.


Andrei


More information about the Digitalmars-d mailing list