Message ID | CABu31nPdef8OphA=G-=YnfmcKPontAeONfv-b3w=pu8GunPTVg@mail.gmail.com |
---|---|
State | New |
Headers | show |
Ping? On Sun, Dec 2, 2012 at 9:27 PM, Steven Bosscher wrote: > Hello, > > The C++ front end pushes everything through the compiler queue after > writing a PCH. This is pointless: After the PCH is written nothing the > compiler does has any effect on it anymore. > > This patch makes the C++ front end stop after writing the PCH, > speeding up PCH creation > > The C front end has behaved this way since 2004 > (http://gcc.gnu.org/ml/gcc-patches/2004-07/msg00738.html). > > Bootstrapped&tested on powerpc64-unknown-linux-gnu and x86_64-unknown-linux-gnu. > OK for trunk? > > Ciao! > Steven > > > > * decl2.c (cp_write_global_declarations): Return after writing a PCH. > > Index: decl2.c > =================================================================== > --- decl2.c (revision 194052) > +++ decl2.c (working copy) > @@ -3944,8 +3944,13 @@ cp_write_global_declarations (void) > || !vec_safe_is_empty (decl_namespace_list)) > return; > > + /* This is the point to write out a PCH if we're doing that. > + In that case we do not want to do anything else. */ > if (pch_file) > - c_common_write_pch (); > + { > + c_common_write_pch (); > + return; > + } > > cgraph_process_same_body_aliases (); > > > > > Compile time at -O2 (test = patched, orig = unpatched): > $ for i in 1 2 3 ; do time ~/devel/build-test/gcc/xg++ > -B../devel/build-test/gcc/ -w -O2 slow.h ; done ; ls -ltr > > real 0m8.577s > user 0m8.037s > sys 0m0.540s > > real 0m8.580s > user 0m8.093s > sys 0m0.484s > > real 0m8.595s > user 0m8.093s > sys 0m0.500s > total 100440 > -rw-r--r-- 1 stevenb stevenb 4017783 2012-12-02 21:16 slow.h > -rw-r--r-- 1 stevenb stevenb 98722192 2012-12-02 21:20 slow.h.gch > $ for i in 1 2 3 ; do time ~/devel/build-orig/gcc/xg++ > -B../devel/build-orig/gcc/ -w -O2 slow.h ; done ; ls -ltr > > real 0m10.795s > user 0m10.273s > sys 0m0.520s > > real 0m10.876s > user 0m10.365s > sys 0m0.544s > > real 0m10.767s > user 0m10.245s > sys 0m0.520s > total 100440 > -rw-r--r-- 1 stevenb stevenb 4017783 2012-12-02 21:16 slow.h > -rw-r--r-- 1 stevenb stevenb 98722192 2012-12-02 21:20 slow.h.gch
On Fri, Dec 7, 2012 at 10:52 AM, Steven Bosscher <stevenb.gcc@gmail.com> wrote: > Ping? Ok if C++ frontend maintainers don't complain over the weekend. Thanks, Richard. > On Sun, Dec 2, 2012 at 9:27 PM, Steven Bosscher wrote: >> Hello, >> >> The C++ front end pushes everything through the compiler queue after >> writing a PCH. This is pointless: After the PCH is written nothing the >> compiler does has any effect on it anymore. >> >> This patch makes the C++ front end stop after writing the PCH, >> speeding up PCH creation >> >> The C front end has behaved this way since 2004 >> (http://gcc.gnu.org/ml/gcc-patches/2004-07/msg00738.html). >> >> Bootstrapped&tested on powerpc64-unknown-linux-gnu and x86_64-unknown-linux-gnu. >> OK for trunk? >> >> Ciao! >> Steven >> >> >> >> * decl2.c (cp_write_global_declarations): Return after writing a PCH. >> >> Index: decl2.c >> =================================================================== >> --- decl2.c (revision 194052) >> +++ decl2.c (working copy) >> @@ -3944,8 +3944,13 @@ cp_write_global_declarations (void) >> || !vec_safe_is_empty (decl_namespace_list)) >> return; >> >> + /* This is the point to write out a PCH if we're doing that. >> + In that case we do not want to do anything else. */ >> if (pch_file) >> - c_common_write_pch (); >> + { >> + c_common_write_pch (); >> + return; >> + } >> >> cgraph_process_same_body_aliases (); >> >> >> >> >> Compile time at -O2 (test = patched, orig = unpatched): >> $ for i in 1 2 3 ; do time ~/devel/build-test/gcc/xg++ >> -B../devel/build-test/gcc/ -w -O2 slow.h ; done ; ls -ltr >> >> real 0m8.577s >> user 0m8.037s >> sys 0m0.540s >> >> real 0m8.580s >> user 0m8.093s >> sys 0m0.484s >> >> real 0m8.595s >> user 0m8.093s >> sys 0m0.500s >> total 100440 >> -rw-r--r-- 1 stevenb stevenb 4017783 2012-12-02 21:16 slow.h >> -rw-r--r-- 1 stevenb stevenb 98722192 2012-12-02 21:20 slow.h.gch >> $ for i in 1 2 3 ; do time ~/devel/build-orig/gcc/xg++ >> -B../devel/build-orig/gcc/ -w -O2 slow.h ; done ; ls -ltr >> >> real 0m10.795s >> user 0m10.273s >> sys 0m0.520s >> >> real 0m10.876s >> user 0m10.365s >> sys 0m0.544s >> >> real 0m10.767s >> user 0m10.245s >> sys 0m0.520s >> total 100440 >> -rw-r--r-- 1 stevenb stevenb 4017783 2012-12-02 21:16 slow.h >> -rw-r--r-- 1 stevenb stevenb 98722192 2012-12-02 21:20 slow.h.gch
On Fri, Dec 7, 2012 at 3:13 PM, Richard Biener wrote: > On Fri, Dec 7, 2012 at 10:52 AM, Steven Bosscher wrote: >> Ping? > > Ok if C++ frontend maintainers don't complain over the weekend. Committed now. BTW I forgot to mention I also did a build+test with this patch and with gcac checking enabled. Ciao! Steven
Index: decl2.c =================================================================== --- decl2.c (revision 194052) +++ decl2.c (working copy) @@ -3944,8 +3944,13 @@ cp_write_global_declarations (void) || !vec_safe_is_empty (decl_namespace_list)) return; + /* This is the point to write out a PCH if we're doing that. + In that case we do not want to do anything else. */ if (pch_file) - c_common_write_pch (); + { + c_common_write_pch (); + return; + } cgraph_process_same_body_aliases ();