<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On 16 January 2014 05:56, Marco Leise <span dir="ltr"><<a href="mailto:Marco.Leise@gmx.de" target="_blank">Marco.Leise@gmx.de</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"><br>
</div>For a moment, I thought the performance crew lost you. :)<br></blockquote><div><br></div><div>Haha, don't worry, that'll never happen! ;)</div><div><br></div><div>I'm just trying to be more open minded in this code I'm writing.</div>
<div>I bring a lot of C/C++ baggage to my D code, so I'm trying to write it in the most idiomatic D way I can, and then I'll do a thorough performance analysis later, and see how far south it went (and what the optimisers we able to do in practise)...</div>
<div>Experience from C/C++ makes me over-cautious wrt performance these days. Modern optimisers are more reliable than the ones I've spent a decade trying to wrestle to do what I want them to.</div><div><br></div><div>
That said though, I still believe there's value in writing explicitly fast code. If you're quite direct, then it doesn't rely so much on an optimiser, and more importantly, it will continue to run well-ish in non-optimised builds. I'm really wrestling with that; it's not a property I'm comfortable to give up, and all these little templates everywhere that do trivial little things are probably going to interfere with non-optimised performance in a way that exceeds my worst nightmares in C++.</div>
<div><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
D's foreach is awesome. Remember this benchmark?<br>
<a href="http://togototo.wordpress.com/2013/08/23/benchmarks-round-two-parallel-go-rust-d-scala-and-nimrod/" target="_blank">http://togototo.wordpress.com/2013/08/23/benchmarks-round-two-parallel-go-rust-d-scala-and-nimrod/</a><br>

The top entry's performance is due to how well LDC2 optimized<br>
the foreach, otherwise the code is quite the same as the C++<br>
version.<br></blockquote><div><br></div><div>Indeed, and I had just presumed that LDC would properly optimise these little functions we're discussing. Rather surprised to learn it doesn't.</div><div>Hopefully it's not so hard to improve with some time.</div>
</div></div></div>