c++ - why are c++ template instantiations inherently slow?
- evansl <cppljevans suddenlink.net> Oct 09 2012
- Nick Sabalausky <SeeWebsiteToContactMe semitwist.com> Nov 01 2012
- evansl <cppljevans suddenlink.net> Nov 03 2012
- Nick Sabalausky <SeeWebsiteToContactMe semitwist.com> Nov 03 2012
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
Oct 09 2012
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.
Nov 01 2012
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.
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
Nov 03 2012
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.
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).
Nov 03 2012









evansl <cppljevans suddenlink.net> 