Templates are slow.

Ethan Watson via Digitalmars-d digitalmars-d at puremagic.com
Thu Sep 8 00:43:10 PDT 2016


On Thursday, 8 September 2016 at 05:02:38 UTC, Stefan Koch wrote:
> I have just hit a barrier trying to optimize the compile-time 
> in binderoo.

I did a double take when Stefan told me the representative sample 
code I gave him to run with Binderoo instantiated ~20,000 
templates and resulted in ~10,000,000 hash map look ups inside 
the compiler.

I can certainly write it to be more optimised, but one of the 
goals I have is to make the codebase human readable so that it's 
not just Manu and myself that can understand the code. As a 
result, I figure this could be representative of how an ordinary 
user would write templated code.


More information about the Digitalmars-d mailing list