<div dir="ltr">On 31 May 2013 21:05, Timon Gehr <span dir="ltr"><<a href="mailto:timon.gehr@gmx.ch" target="_blank">timon.gehr@gmx.ch</a>></span> wrote:<br><div class="gmail_extra"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div class="im">On 05/31/2013 12:58 PM, Joseph Rushton Wakeling wrote:<br>
</div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="im">
On 05/31/2013 08:34 AM, Manu wrote:<br>
</div><div class="im"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
What's taking the most time?<br>
The lighting loop is so template-tastic, I can't get a feel for how fast that<br>
loop would be.<br>
</blockquote>
<br></div><div class="im">
Hah, I found this out the hard way recently -- have been doing some experimental<br>
reworking of code where some key inner functions were templatized, and it had a<br>
nasty effect on performance.  I'm guessing it made it impossible for the<br>
compilers to inline these functions :-(<br>
<br>
</div></blockquote>
<br>
That wouldn't make any sense though, since after template expansion there is no difference between the generated version and a particular handwritten version.<br>
</blockquote></div><br></div><div class="gmail_extra" style>Assuming that you would hand-write exactly the same code as the template expansion...</div><div class="gmail_extra" style>Typically template expansion leads to countless temporary redundancies, which you expect the compiler to try and optimise away, but it's not always able to do so, especially if there is an if() nearby, or worse, a pointer dereference.</div>
</div>