This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/71029] New: large fold expressions compile slowly with -Wall
- From: "alisdairm at me dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Mon, 09 May 2016 18:32:56 +0000
- Subject: [Bug c++/71029] New: large fold expressions compile slowly with -Wall
- Auto-submitted: auto-generated
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71029
Bug ID: 71029
Summary: large fold expressions compile slowly with -Wall
Product: gcc
Version: 6.1.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: alisdairm at me dot com
Target Milestone: ---
Created attachment 38456
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=38456&action=edit
file is very slow compiled with Wall
The attached file uses a simple fold expression over a comma operator to
consume 'get<N>' on each element of a std::array<int, 2048>, so essentially
2047 comma operators separating empty 'sink' function calls.
On my current machine, with just with just g++ -std=c++1z file.cpp, this takes
around 2.5 seconds to compile. With g++ -std=c++1z -Wall file.cpp it takes 25
seconds, and still reports no warnings.
The generated code is also quite large, regardless of warning setting,
generating an executable of around 650k. This is less than 5k when compiled
-O3.
Running the same scenario through Clang, the unoptimized code produced s 90k
executable, and consistently gives a 1.5 second compile time, regardless of
warning level.
I suspect that Clang is getting in an early optimization around the do-nothing
function to eliminate a lot of code prior to running warning passes, but that
is entirely speculation as I have no idea how either compiler is implemented ;)
For the curious, compiling with the latest gcc 7 branch available through
MacPorts, this takes around 60% longer again although I am not sure if that
compiler is built with the same optimization settings as the released gcc 6.1
compiler.