public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "redi at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/60976] Compilation with G++ 4.9.0 is 2-3 times slower than with 4.8.2 Date: Mon, 19 Oct 2015 20:54:00 -0000 [thread overview] Message-ID: <bug-60976-4-j9xSfoBbpK@http.gcc.gnu.org/bugzilla/> (raw) In-Reply-To: <bug-60976-4@http.gcc.gnu.org/bugzilla/> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=60976 Jonathan Wakely <redi at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |jason at gcc dot gnu.org --- Comment #20 from Jonathan Wakely <redi at gcc dot gnu.org> --- (In reply to Giuseppe Ottaviano from comment #19) > At Facebook we experienced a similar regression, compilation times more than > doubled for several large C++ files. > We found that the regression was mostly caused by r207240, specifically to > the changes in bits/alloc_traits.h. Just reverting that file brought back > build times almost to previous levels. > > By looking at GCC profiles, a disproportionate amount of time is spent in > structural_comptypes and template_args_equal (which doesn't happen before > the change). The revision only changes the way some traits are selected > through SFINAE, specifically the pattern: > > template <typename T> enable_if<..., R>::type f(); > > became > > template <typename T, typename = _Require<...>> R f(); > > and _Require is just a wrapper around enable_if. Jason, this is an interesting observation about where time is spent in the FE for this common SFINAE technique. I use it for constructors, where there is no return value on which to put the enable_if, and where adding an extra constructor parameter with a default argument would change the signature (or be impossible, due to the constructor being a variadic template). Any chance this is low-hanging fruit and could be avoided fairly easily, or should I stop using this technique in bits of the library that are compiled as often as allocator_traits? > I don't know why this change has such a large impact on compilation times, > it would deserve some investigation. Other parts of the standard library > might be affected by this. Very probably, I have used that pattern widely. > The regression might have been already solved in r225244, which uses yet > another SFINAE pattern without extra template arguments, which I believe are > the cause of the regression. However I haven't tested it yet. That would be nice to know, because I now use that kind of void_t-style constraint in a few places, and plan to use it more widely. My measurements do show that using void_t-style constraints result in small but measurable reductions in compile time and memory use.
next prev parent reply other threads:[~2015-10-19 20:54 UTC|newest] Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top 2014-04-26 15:36 [Bug c++/60976] New: " astellar at ro dot ru 2014-04-26 15:37 ` [Bug c++/60976] " astellar at ro dot ru 2014-04-26 15:38 ` astellar at ro dot ru 2014-04-26 15:38 ` astellar at ro dot ru 2014-04-28 22:56 ` astellar at ro dot ru 2014-04-28 22:56 ` astellar at ro dot ru 2014-04-28 22:57 ` astellar at ro dot ru 2014-04-28 22:58 ` astellar at ro dot ru 2014-04-28 22:58 ` astellar at ro dot ru 2014-04-28 22:59 ` astellar at ro dot ru 2014-04-29 7:58 ` redi at gcc dot gnu.org 2015-04-08 7:00 ` rene.koecher@wincor-nixdorf.com 2015-04-08 8:42 ` trippels at gcc dot gnu.org 2015-04-08 9:02 ` redi at gcc dot gnu.org 2015-04-09 7:16 ` rene.koecher@wincor-nixdorf.com 2015-04-09 9:07 ` redi at gcc dot gnu.org 2015-04-09 9:10 ` rene.koecher@wincor-nixdorf.com 2015-04-09 9:12 ` redi at gcc dot gnu.org 2015-04-09 9:47 ` trippels at gcc dot gnu.org 2015-10-19 19:21 ` ott at fb dot com 2015-10-19 20:54 ` redi at gcc dot gnu.org [this message] 2015-10-19 21:25 ` redi at gcc dot gnu.org 2015-10-19 22:42 ` ott at fb dot com 2015-10-20 0:05 ` redi at gcc dot gnu.org 2015-10-21 3:32 ` ott at fb dot com 2015-10-21 19:33 ` ott at fb dot com 2015-10-21 20:27 ` redi at gcc dot gnu.org 2015-10-22 6:35 ` rene.koecher@wincor-nixdorf.com 2015-10-22 7:12 ` ott at fb dot com 2015-10-25 2:56 ` redi at gcc dot gnu.org
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=bug-60976-4-j9xSfoBbpK@http.gcc.gnu.org/bugzilla/ \ --to=gcc-bugzilla@gcc.gnu.org \ --cc=gcc-bugs@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
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).