public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libstdc++/62056] New: Long compile times with large tuples
@ 2014-08-07 20:05 kaballo86 at hotmail dot com
  2014-09-29  8:36 ` [Bug libstdc++/62056] " redi at gcc dot gnu.org
                   ` (10 more replies)
  0 siblings, 11 replies; 12+ messages in thread
From: kaballo86 at hotmail dot com @ 2014-08-07 20:05 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=62056

            Bug ID: 62056
           Summary: Long compile times with large tuples
           Product: gcc
           Version: 4.10.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: libstdc++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: kaballo86 at hotmail dot com

Created attachment 33270
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=33270&action=edit
draft flat tuple implementation

The recursive implementation of `std::tuple` causes noticeable longer
compilation times and memory usage than a non-recursive implementation would.
Furthermore, with a max template depth of 256 (Clang's default), the following
test case results in a compilation error when attempting to use `make_tuple` 
with more than 17 arguments:

    #include <tuple>

    struct T {} t;

    int main()
    {
      auto tt = std::make_tuple(
        t, t, t, t, t, t, t, t,
        t, t, t, t, t, t, t, t,
        t, t
        );
      return sizeof(std::get<15>(tt));
    }

The times reported for building this example with one less argument to
`make_tuple` are:

 TOTAL                 :   0.45             34300 kB
 TOTAL (-O2)           :   0.37             28160 kB

With a flat implementation (draft attached), the times reported are:

 TOTAL                 :   0.31             21245 kB
 TOTAL (-O2)           :   0.21             18056 kB

With the default template depth limit of 900, the limit is reached with more
than 63 elements for the recursive implementation, and more than 253 elements
for the flat implementation (reached while building an `index_sequence`).

The times reported for building a similar example but with 63 elements are:

 TOTAL (recursive)     :   0.96            102293 kB
 TOTAL (recursive -O2) :   0.58             77839 kB
 TOTAL (flat)          :   0.27             33737 kB
 TOTAL (flat -O2)      :   0.20             27213 kB


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

end of thread, other threads:[~2014-10-07 11:25 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-08-07 20:05 [Bug libstdc++/62056] New: Long compile times with large tuples kaballo86 at hotmail dot com
2014-09-29  8:36 ` [Bug libstdc++/62056] " redi at gcc dot gnu.org
2014-09-29 14:21 ` [Bug c++/62056] " piotrdz at gmail dot com
2014-09-30  6:25 ` piotrdz at gmail dot com
2014-09-30 13:34 ` kaballo86 at hotmail dot com
2014-09-30 17:38 ` manu at gcc dot gnu.org
2014-09-30 20:20 ` kaballo86 at hotmail dot com
2014-10-01 20:35 ` manu at gcc dot gnu.org
2014-10-01 20:47 ` [Bug libstdc++/62056] " redi at gcc dot gnu.org
2014-10-01 23:36 ` manu at gcc dot gnu.org
2014-10-02  8:54 ` redi at gcc dot gnu.org
2014-10-07 11:25 ` redi at gcc dot gnu.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).