public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/38132]  New: std::string is faster with -D_GLIBCXX_DEBUG=1 than without
@ 2008-11-15 13:56 edwintorok at gmail dot com
  2008-11-15 13:58 ` [Bug c++/38132] " edwintorok at gmail dot com
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: edwintorok at gmail dot com @ 2008-11-15 13:56 UTC (permalink / raw)
  To: gcc-bugs

basic_string.tcc contains 'extern template basic_string<char>', which prevents
the template from being instantiated, and thus all calls to basic_string
methods remain calls even at -O3.

If I -D_GLIBCXX_DEBUG=1 _GLIBCXX_EXTERN_TEMPLATE is 0, thus it will no longer
contain 'extern template basic_string<char>', so the body of methods will be
available, and inlining will be performed.

However _GLIBCXX_DEBUG=1 activates debug code, so  I would like to be able to
get the methods inlined w/o definining debug mode.

Can the semantics of 'extern template' be changed [*] in such a way, that *if*
the body of some of the methods are suitable for inlining, they will be inlined
(and other methods won't get instantiated), and if none of the methods are
suitable, the behaviour stays as currently.

[*] by introducing a new compiler flag, that can be activated at -O3 (and maybe
-O2) at the expense of code size.


-- 
           Summary: std::string is faster with -D_GLIBCXX_DEBUG=1 than
                    without
           Product: gcc
           Version: 4.3.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: edwintorok at gmail dot com
 GCC build triplet: x86_64-linux-gnu
  GCC host triplet: x86_64-linux-gnu
GCC target triplet: x86_64-linux-gnu


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38132


^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2009-04-17 10:50 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-11-15 13:56 [Bug c++/38132] New: std::string is faster with -D_GLIBCXX_DEBUG=1 than without edwintorok at gmail dot com
2008-11-15 13:58 ` [Bug c++/38132] " edwintorok at gmail dot com
2008-11-15 15:43 ` [Bug c++/38132] extern template prohibits inlining rguenth at gcc dot gnu dot org
2009-04-16 22:10 ` pinskia at gcc dot gnu dot org
2009-04-17  9:23 ` [Bug libstdc++/38132] basic_string.tcc methods not declared inline rguenth at gcc dot gnu dot org
2009-04-17 10:12 ` paolo dot carlini at oracle dot com
2009-04-17 10:28 ` paolo dot carlini at oracle dot com
2009-04-17 10:50 ` rguenth at gcc dot gnu dot org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).