<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On 14 January 2014 20:25, John Colvin <span dir="ltr"><<a href="mailto:john.loughran.colvin@gmail.com" target="_blank">john.loughran.colvin@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="im">On Tuesday, 14 January 2014 at 09:07:43 UTC, Manu wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Can anyone comment on the codegen when using these statements? Is it<br>
identical to my reference 'if' statement?<br>
Liberal use of loops like this will probably obliterate unoptimised<br>
performance... :/<br>
</blockquote>
<br></div>
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.<br>

<br>
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?<br>
</blockquote></div><br></div><div class="gmail_extra">Sorry, that was 2 separate points although it didn't look like it.</div><div class="gmail_extra">The first question was assuming full optimisation, is it equivalent to the if statement I demonstrate with full optimisation in practise? (I'll do some tests, but people must have already experimented in various circumstances, and identified patterns?)</div>
<div class="gmail_extra"><br></div><div class="gmail_extra">The second comment about non-optimised builds; you are correct, it's important that debug builds remain useful/playable.</div><div class="gmail_extra">I have worked in codebases where debug builds run in the realm of 1-2 fps, literally unplayable and entirely useless.. This is a MASSIVE productivity hinderance.</div>
<div class="gmail_extra">By contrast, at krome, we took great pride in that our debug build ran at around 10-15fps (actually playable, and quite a unique achievement which did not go unappreciated), which meant we could actually debug complex bugs while still being able to reproduce them.</div>
<div class="gmail_extra">This was almost entirely attributed to our (unpopular) insistence on writing our engine in C instead of C++.</div><div class="gmail_extra">Sadly, I don't see D being any better than C++ in this case. It's likely worse than C++, since it's more convenient, and therefore more compelling to use these meta features.</div>
<div class="gmail_extra"><br></div><div class="gmail_extra">I'd like to know if anybody can see any path towards inlined lambda's/literal's/micro-functions in non-optimised builds?</div><div class="gmail_extra">
I guess the first question is, is this a problem that is even worth addressing? How many people are likely to object in principle?</div></div>