On Wednesday, 14 May 2014 at 23:50:34 UTC, Meta wrote:
On the topic of lazy, why *is* it so slow, exactly? I thought it was just shorthand for taking a function that evaluates the expression, and wrapping said expression in that function at the call site. That is, I thought that:

int doSomething(lazy int n)
{
    return n();
}

Was more or less equivalent to:

int doSomething(int function(int) n)
{
    return n();
}

It's more equivalent to:

int doSomething(int delegate(int) n)
{
    return n();
}

And (I could be very likely wrong here), I believe that it's expensive because it's not scope and possibly requires a closure. Again, very likely may be wrong.
  • Array!T and find are slow Damian Day via Digitalmars-d-learn
    • Re: Array!T and find are... David Nadlinger via Digitalmars-d-learn
      • Re: Array!T and find... Damian Day via Digitalmars-d-learn
        • Re: Array!T and ... David Nadlinger via Digitalmars-d-learn
          • Re: Array!T ... Kapps via Digitalmars-d-learn
            • Re: Arr... monarch_dodra via Digitalmars-d-learn
            • Re: Arr... Jonathan M Davis via Digitalmars-d-learn
            • Re: Arr... Meta via Digitalmars-d-learn
              • Re:... Kapps via Digitalmars-d-learn
                • ... Jonathan M Davis via Digitalmars-d-learn
                • ... monarch_dodra via Digitalmars-d-learn
                • ... Jonathan M Davis via Digitalmars-d-learn
                • ... monarch_dodra via Digitalmars-d-learn
                • ... Ary Borenszweig via Digitalmars-d-learn
                • ... Jonathan M Davis via Digitalmars-d-learn
                • ... Steven Schveighoffer via Digitalmars-d-learn
                • ... Jonathan M Davis via Digitalmars-d-learn
                • ... w0rp via Digitalmars-d-learn
              • Re:... Steven Schveighoffer via Digitalmars-d-learn

Reply via email to