<div dir="ltr"><div class="gmail_extra"><br><div class="gmail_quote">On 10 June 2013 02:28, Walter Bright <span dir="ltr"><<a href="mailto:walter@digitalmars.com" target="_blank">walter@digitalmars.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div class="im"><br>
On 6/9/2013 1:32 PM, Don Clugston wrote:<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<br>
Yeah. 4 orders of magnitude. Our codebase at sociomantic is a bit larger than Phobos + druntime, but it compiles in just a few seconds.<br>
The problem is, that because of templates, the memory consumption isn't linear with source size.<br>
<br>
dmd -unittest -o- std/algorithm<br>
<br>
instantiates 344150 templates. Yes 344K. More than a third of a million.<br>
</blockquote>
<br></div>
Wow! (How many of those are unique, rather than reusing an existing instantiation?)</blockquote><div><br></div><div class="im">I'm not sure. That's the number of calls to the constructor of TemplateInstance. I don't understand the code well enough to know<br>
</div><div class="im">if it can eventually gets merged with an existing TemplateInstance.<br></div><div class="im">If so, then perhaps there's something we could do to prevent them from getting created in the first place if they are duplicates.<br>
</div><div class="im">Certainly there are a huge number of instantiations of things like:<br></div><div class="im">hasLength, isNarrowString, isForwardRange<br></div><div class="im">It seems hard to believe there would be enough types to instantiate isNarrowString thousands of different times.<br>
</div><div class="im"><br></div><div class="im"><br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
More than the number of lines of source in the module.<br>
And yet there are only 1305 asserts in that module -- the tests are not particularly comprehensive.<br>
<br>
</blockquote>
<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
-cov shows 96% coverage for std.algorithm</blockquote><div><br></div><div>Yeah, my point was that for N tests, we get O(N^^2) templates instantiated.<br></div><br></div></div></div>