Here's a case where the C++ front-end is still slow, despite the great improvements in GCC 4. This is preprocessed with Apple's 4.x compiler. From, 'g++ IC.ii -ftime-report -O0 -o /dev/null -S', I get: parser : 1.84 (27%) usr 1.48 (29%) sys 3.22 (27%) wall name lookup : 1.47 (22%) usr 2.59 (51%) sys 4.06 (34%) wall ... TOTAL : 6.73 5.04 11.88 On a somewhat scary note, compiling without -ftime-report speeds up the compilation from 0:11.95 to 0:04.39. This leads me to believe that the -ftime-report numbers can't be trusted very much. More testcases are always good right? -Chris
Created attachment 9886 [details] Large C++ file
(In reply to comment #0) > On a somewhat scary note, compiling without -ftime-report speeds up the > compilation from 0:11.95 to 0:04.39. This leads me to believe that the > -ftime-report numbers can't be trusted very much. This is because Darwin's timing functions are slow.
Confirmed. The middle-end problems are almost all in reload.c. For the profile, everything is just spread all around.
I think this is just a problem of templates, lots of them.
Some updates: the -ftime-report problems were a local problem with apple's gcc, now fixed. This testcase has some templates (e.g. the match stuff), but mostly it is just big branchy compiler code :), not atypical of many C++ programs. -Chris
In 4.2.0 on i686-linux-gnu this is much better: parser : 1.99 (31%) usr 0.28 (28%) sys 2.42 (25%) wall 43674 kB (49%) ggc name lookup : 0.48 ( 7%) usr 0.37 (37%) sys 1.51 (16%) wall 5041 kB ( 6%) ggc
Note, I am not going to close this bug just yet because this testcase produces some weird -O2 timing results for 4.2.0: tree operand scan : 11.29 (27%) usr 0.51 (22%) sys 13.09 (25%) wall 9015 kB ( 4%) ggc
*** Bug 58575 has been marked as a duplicate of this bug. ***
Author: ppalka Date: Thu Jan 28 01:06:29 2016 New Revision: 232912 URL: https://gcc.gnu.org/viewcvs?rev=232912&root=gcc&view=rev Log: Low-hanging C++-lexer speedup (PR c++/24208) gcc/cp/ChangeLog: PR c++/24208 * parser.c (LEXER_DEBUGGING_ENABLED_P): New macro. (cp_lexer_debugging_p): Use it. (cp_lexer_start_debugging): Likewise. (cp_lexer_stop_debugging): Likewise. Modified: trunk/gcc/cp/ChangeLog trunk/gcc/cp/parser.c
The testcase no longer works, even after unincluding. There have been improvements to the operand scanner, so let's close it as fixed.