Array!T and find are slow

Steven Schveighoffer via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Thu May 15 06:11:13 PDT 2014


On Wed, 14 May 2014 19:50:33 -0400, Meta <jared771 at gmail.com> wrote:

> On Wednesday, 14 May 2014 at 22:32:01 UTC, Jonathan M Davis via  
> Digitalmars-d-learn wrote:
>> Yeah, much as Andrei would hate to hear it (enforce was his idea, and  
>> he quite
>> likes the idiom), the fact that lazy is so inefficient makes it so that  
>> it's
>> arguably bad practice to use it in high performance code. We really  
>> need to
>> find a way to make it so that lazy is optimized properly so that we  
>> _can_
>> safely use enforce, but for now, it's not a good idea unless the code  
>> that
>> you're working on can afford the performance hit.
>>
>> Honestly, in general, I'd avoid most anything which uses lazy (e.g.  
>> that's why
>> I'd use explict try-catch blocks rather than use
>> std.exception.assumeWontThrow - like enforce, it's a nice idea, but  
>> it's too
>> expensive at this point).
>>
>> - Jonathan M Davis
>
> On the topic of lazy, why *is* it so slow, exactly?

Last time I remember, the issue is that functions with lazy parameters  
will never be inlined.

-Steve


More information about the Digitalmars-d-learn mailing list