Templates do maybe not need to be that slow (no promises)

Stefan Koch via Digitalmars-d digitalmars-d at puremagic.com
Fri Sep 9 03:32:59 PDT 2016


On Friday, 9 September 2016 at 09:31:37 UTC, Marco Leise wrote:
>
> Don't worry about this special case too much. At least GCC can 
> turn padLength from a runtime argument into a compile-time 
> argument itself, so the need for templates to do a poor man's 
> const-folding is reduced. So in this case the advise is not to 
> use a template.
>
> You said that there is a lot of code-gen and string comparisons 
> going on. Is code-gen already invoked on-demand? I assume with 
> "dmd -o-" code-gen is completely disabled, which is great for 
> ddoc, .di and dependency graph generation.

This is not what this is about.
This is about cases where you cannot avoid templates because you 
do type-based operations.

The code above was just an example to illustrate the problem.



More information about the Digitalmars-d mailing list