foreach thoughts

John Colvin john.loughran.colvin at gmail.com
Tue Jan 14 02:25:36 PST 2014


On Tuesday, 14 January 2014 at 09:07:43 UTC, Manu wrote:
> Can anyone comment on the codegen when using these statements? 
> Is it
> identical to my reference 'if' statement?
> Liberal use of loops like this will probably obliterate 
> unoptimised
> performance... :/

In my experience, unoptimised performance will suffer due to the 
various function calls and intermediate structs which will be 
generated naively as-written. Generic range programming in D 
depends heavily on optimisers to denest everything, which gdc and 
ldc do manage quite successfully.

Am I correct in thinking that you want (near)playably fast debug 
builds? I think that will require some extra thought to achieve 
in idiomatic D compared to your usual C++ work. pragma(optimise) 
anyone?


More information about the Digitalmars-d mailing list