On Tue, Jun 1, 2010 at 6:32 PM, Vladimir Makarov <vmaka...@redhat.com> wrote: > Richard Guenther wrote: >> >> On Tue, Jun 1, 2010 at 12:00 PM, Richard Guenther >> <richard.guent...@gmail.com> wrote: >> >>> >>> On Mon, May 31, 2010 at 6:22 PM, Diego Novillo <dnovi...@google.com> >>> wrote: >>> >>>> >>>> Now that the SC and the FSF have agreed to this, we should decide >>>> whether we >>>> switch and how. So, I would like comments on the following questions: >>>> >>>> 1- Should we switch to C++? >>>> >>> >>> Yes. >>> >>> >>>> >>>> 2- What is the cost in terms of build time? >>>> >>> >>> I was trying to measure but --enable-build-with-cxx is broken at >>> the moment. >>> >> >> After fixing build locally I now have >> >> ../configure && /usr/bin/time make >> 9197.01user 367.66system 2:42:39elapsed 98%CPU (0avgtext+0avgdata >> 2846176maxresident)k >> 1664096inputs+22984320outputs (537major+193300027minor)pagefaults 0swaps >> >> ../configure --enable-stage1-languages=c,c++ && /usr/bin/time make >> 9954.58user 412.32system 2:55:20elapsed 98%CPU (0avgtext+0avgdata >> 2846160maxresident)k >> 1386568inputs+26276920outputs (511major+219861615minor)pagefaults 0swaps >> >> 8% for adding C++ to the set of languages bootstrapped >> >> ../configure --enable-build-with-cxx && /usr/bin/time make >> 10072.37user 426.85system 2:57:15elapsed 98%CPU (0avgtext+0avgdata >> 2847472maxresident)k >> 1408096inputs+22940928outputs (377major+223161175minor)pagefaults 0swaps >> >> 1.5% for using C++ to do the building. >> >> > > That is a really small increase for building time. > > I was interested more in how much g++ is slower gcc in -O2 mode. > > I've done such comparison for gcc & g++ compilation time on most GCC C files > (from gcc directory) and got in average 10% (when gcc/g++ of version 4.6 > were used) - 20% (when gcc/g++ of version 4.3 were used) more compiler time > when g++ is used. The used gcc/g++ compilers were build in release mode > and the used machine was Corei7.
My testing was obviously dominated by building libjava so I have repeated the above test with just C and C++ which should hit the worst case. /space/rguenther/src/svn/trunk/configure --enable-languages=c,c++ 4533.03user 182.35system 1:19:36elapsed 98%CPU (0avgtext+0avgdata 1744064maxresident)k 354032inputs+11561160outputs (125major+97529278minor)pagefaults 0swaps /space/rguenther/src/svn/trunk/configure --enable-stage1-languages=c,c++ --enable-languages=c,c++ 5304.18user 228.37system 1:33:24elapsed 98%CPU (0avgtext+0avgdata 1744048maxresident)k 535560inputs+14853792outputs (128major+124069696minor)pagefaults 0swaps That's a 15% increase because we now bootstrap C++. /space/rguenther/src/svn/trunk/configure --enable-build-with-cxx --enable-languages=c,c++ 5366.71user 232.97system 1:34:48elapsed 98%CPU (0avgtext+0avgdata 2321968maxresident)k 675848inputs+11452440outputs (1852major+124962774minor)pagefaults 0swaps On top of that a 1.2% increase because we do so with a C++ compiler. The size of the cc1 binary is when built with the C compiler text data bss dec hex filename 12050451 615264 670688 13336403 cb7f53 gcc/cc1 and when built with the C++ compiler it is text data bss dec hex filename 12327963 40344 1245888 13614195 cfbc73 gcc/cc1 which translates to a 2.3% size increase for the text part. I also notice that all cc1 binaries are dynamically linked against libstdc++ - didn't we want to use -static-libstdc++ and link against the libstdc++ we bootstrap? Richard.