On Friday, 26 February 2016 at 18:53:21 UTC, Andrei Alexandrescu wrote:
My understanding is the main problem is the _same_ templates are repeatedly instantiated with the same exact parameters - the epitome of redundant work. -- Andrei

Within one compiler execution, there might be some optimization potential in the way semantically equivalent template instantiations are merged, yes – it's been a while since I have looked at the related code (see e.g. TemplateDeclaration.findExistingInstance).

Another area matching your description would be that of the same template being instantiated from multiple compilation units, where it can be omitted from some of the compilation units (i.e. object files). Our current logic for that is broken anyway, see e.g. https://issues.dlang.org/show_bug.cgi?id=15318.

I was referring to something different in my post, though, as the question concerned "low-hanging fruit". The problem there is really just that template names sometimes grow unreasonably long pretty quickly. As an example, without wanting to divulge any internals, some of the mangled symbols (!) in the Weka codebase are several hundred kilobytes in size. core.demangle gives up on them anyway, and they appear to be extremely repetitive. Note that just like in Steven's post which I linked earlier, the code in question does not involve any crazy recursive meta-templates, but IIRC makes use of Voldemort types. Tracking down and fixing this – one would almost be tempted to just use standard data compression – would lead to a noticeable decrease in compile and link times for affected code.

 — David

Reply via email to