hidden passing of __FILE__ and __LINE__ into function

Lewis via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Tue Apr 18 20:34:06 PDT 2017


On Monday, 17 April 2017 at 14:23:50 UTC, Jonathan M Davis wrote:
> On Monday, April 17, 2017 13:45:18 Dmitry via 
> Digitalmars-d-learn wrote:
>> [...]
>
> Every time there's a new template instantiation, it's 
> essentially copy-pasting the entire template. So, if you have 
> the templated function
>
> [...]

The other reason to avoid excessive template instantiation is 
that it inflates your compile time. A while back I changed my 
custom assertf() and logf() functions to be non-templated in 
exactly the way Jonathan M Davis described, and it shaved ~0.5s 
off my 3s build time. This particular project is currently only 
8000 LOC, but on a larger project you can see the hit could be 
pretty significant.


More information about the Digitalmars-d-learn mailing list