This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

C++ Template instantiations efficiency (COMDAT, LINKONCE, ...) status in gcc 4.X series


Hi and thanks to the contributors of g++ (and the whole gcc suite) ... what a tremendous value!

If I have to pinpoint my question, I would refer to gcc internals documentation section 11.10.4 "Functions for C++", macro name DECL_LINKONCE_P which is said to be "Not yet implemented".

Then the question is "Can we expect further (compile-and-link time) efficiencies when this internal DECL_LINKONCE_P is implemented in a later release in the 4.X series?

I assume the answer is no, as long as COMDAT support is provided in the linker. If such is the case, the suggestion is to add e.g. "The usefulness of DECL_LINKONCE_P appears questionable because COMDAT support by the link process is needed anyway for avoiding object code duplication and DECL_LINKONCE_P has no influence on this matter."

Generally, the optimization of template instantiations remains a bit obscure for the g++ user. The performance improvement announced with gcc 4.5 seems unrelated to the COMDAT optimization of executable size. Is this correct?

On one project, I used -fno-implicit-templates since I felt that a static library build process would benefit from it (every anticipated template specializations is included in the library). On another project, I felt a need to use -frepo (I don't recall exactly why). While trying to merge the two projects, I found that the g++ compiler (with GNU ld) was working just fine with the default setting for template specializations. Seems great!

(Thinking while I write now, maybe DECL_LINKONCE_P might be relevant to distinguish compilation runs with -frepo in contexts where the link process does not support COMDAT.)

If you follow my thinking (I'm not sure I always do when applying advanced C++ abstraction in actual code development), I wish to have an understanding of compile-time efficiencies when the C++ template mechanism is heavily used. More specifically, I am afraid that compile-time would become un-manageable as a project grows from a code base just too heavily dependent on the STL. But the STL concepts are so attractive!

Once upon a time there was the Borland model ... I guess g++ makes this a thing of the past. Is this a fair assessment?

Best regards.

--
- Thierry Moreau

CONNOTECH Experts-conseils inc.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]