c++ - why are c++ template instantiations inherently slow?
- evansl (12/12) Oct 09 2012 In this post:
- Nick Sabalausky (5/23) Nov 01 2012 "C++ Compilation Speed" by Walter Bright:
- evansl (9/36) Nov 03 2012 Thanks very much for the link Nick.
- Nick Sabalausky (7/22) Nov 03 2012 Not that I know of, but I would assume it's because (IIUC) those are
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
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: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, LarryIn 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
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: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)."C++ Compilation Speed" by Walter Bright: http://www.drdobbs.com/cpp/c-compilation-speed/228701711Thanks 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?
Nov 03 2012