View mode: basic / threaded / horizontal-split · Log in · Help
October 09, 2012
why are c++ template instantiations inherently slow?
In this post:

 http://article.gmane.org/gmane.comp.lib.boost.devel/189925

Eric indicates that Walter Bright believes, in c++:

 that instantiating a template is inherently expensive, and certain
 features of the C++ language (ADL, partial specialization, etc.)
 force that to be the case.

Walter, if Eric is remembering correctly, could you provide a little
more explanation on why this is so or provide a link to some document
supporting this conclusion?

TIA.

-regards,
Larry
November 01, 2012
Re: why are c++ template instantiations inherently slow?
On Tue, 09 Oct 2012 15:59:26 -0500
evansl <cppljevans@suddenlink.net> wrote:

> In this post:
> 
>   http://article.gmane.org/gmane.comp.lib.boost.devel/189925
> 
> Eric indicates that Walter Bright believes, in c++:
> 
>   that instantiating a template is inherently expensive, and certain
>   features of the C++ language (ADL, partial specialization, etc.)
>   force that to be the case.
> 
> Walter, if Eric is remembering correctly, could you provide a little
> more explanation on why this is so or provide a link to some document
> supporting this conclusion?
> 
> TIA.
> 
> -regards,
> Larry

"C++ Compilation Speed" by Walter Bright:
http://www.drdobbs.com/cpp/c-compilation-speed/228701711

Note the #7.
November 03, 2012
Re: why are c++ template instantiations inherently slow?
On 11/01/12 04:29, Nick Sabalausky wrote:
> On Tue, 09 Oct 2012 15:59:26 -0500
> evansl <cppljevans@suddenlink.net> wrote:
> 
>> In this post:
>>
>>   http://article.gmane.org/gmane.comp.lib.boost.devel/189925
>>
>> Eric indicates that Walter Bright believes, in c++:
>>
>>   that instantiating a template is inherently expensive, and certain
>>   features of the C++ language (ADL, partial specialization, etc.)
>>   force that to be the case.
>>
>> Walter, if Eric is remembering correctly, could you provide a little
>> more explanation on why this is so or provide a link to some document
>> supporting this conclusion?
>>
>> TIA.
>>
>> -regards,
>> Larry
> 
> "C++ Compilation Speed" by Walter Bright:
> http://www.drdobbs.com/cpp/c-compilation-speed/228701711
> 
> Note the #7.
> 
Thanks very much for the link Nick.
I read it and now I'm heavily leaning toward
converting to D now.

However, I saw no mention of ADL and partial specialization.
Is there some other reference explaining why these lead to
slow compile times?

-regards,
Larry
November 04, 2012
Re: why are c++ template instantiations inherently slow?
On Sat, 03 Nov 2012 12:36:00 -0500
evansl <cppljevans@suddenlink.net> wrote:

> On 11/01/12 04:29, Nick Sabalausky wrote:
> > 
> > "C++ Compilation Speed" by Walter Bright:
> > http://www.drdobbs.com/cpp/c-compilation-speed/228701711
> > 
> > Note the #7.
> > 
> Thanks very much for the link Nick.
> I read it and now I'm heavily leaning toward
> converting to D now.
> 
> However, I saw no mention of ADL and partial specialization.
> Is there some other reference explaining why these lead to
> slow compile times?
> 

Not that I know of, but I would assume it's because (IIUC) those are
heavily template-oriented things which, in turn, are slow in C++
because of the reasons he described. You could try asking over on the
"digitalmars.D" newsgroup, as that tends to get a lot more traffic
(same NNTP server as here, ie, news.digitalmars.com).
Top | Discussion index | About this forum | D home