<div class="gmail_quote">On 29 May 2012 15:10, Jacob Carlborg <span dir="ltr"><<a href="mailto:doob@me.com" target="_blank">doob@me.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="HOEnZb"><div class="h5">On 2012-05-29 12:25, Manu wrote:<br>
</div></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div class="h5">
I've been trying to work out why my compile times have gone to hell<br>
recently.<br>
<br>
I have a lib, it takes 3.5 seconds to compile.<br>
I add one CTFE heavy module, it's not huge, certainly much smaller than<br>
the rest of the app, and it blows out to 18 seconds. I've done some<br>
experiments removing bits and pieces of code, I can isolate the bits<br>
that add seconds to the compile time, but the big offenders are one-line<br>
mixins which use CTFE fairly aggressively to generate the strings they<br>
mix in.<br>
<br>
Can anyone comment on CTFE as implemented? Why is it so slow? It's<br>
certainly not executing a lot of code. I can imagine executing the same<br>
routine in an interpreted language like lua would take milliseconds or<br>
less, not multiple seconds.<br></div></div><div class="im">
What are the bottlenecks? Is there any way to improve it?<br>
</div></blockquote>
<br>
Many small string mixins are slow, even if they're string literals and not generated. If possible, it's better with one huge string mixin.</blockquote><div><br></div><div>That's interesting. I can probably give that a shot.</div>
<div>So you think that's a bigger cost than the CTFE code that generates the strings?</div></div>