Array!T and find are slow

monarch_dodra via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Thu May 15 00:42:33 PDT 2014


On Thursday, 15 May 2014 at 06:52:44 UTC, Jonathan M Davis via 
Digitalmars-d-learn wrote:
> On Thu, 15 May 2014 05:53:45 +0000
> monarch_dodra via Digitalmars-d-learn
> <digitalmars-d-learn at puremagic.com> wrote:
>
>> As a workaround, I'm sure we could specialize enforce without
>> lazy for built-in types?
>
> No. I don't think that that would work. The problem is that 
> you'd have to be
> able to overload between stuff like "error message" and
> format("error message: %s", foo), because you don't want the 
> first one to be
> lazy, whereas you do want the second one to be lazy.

Oh... right. It's the *second* parameter that's lazy.

Arguably, the compiler should be able too "see" if the argument 
passed is a value or an expression though, and optimize 
accordingly.


More information about the Digitalmars-d-learn mailing list