This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug libstdc++/62056] New: Long compile times with large tuples
- From: "kaballo86 at hotmail dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Thu, 07 Aug 2014 20:05:24 +0000
- Subject: [Bug libstdc++/62056] New: Long compile times with large tuples
- Auto-submitted: auto-generated
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