Hello, I use Ubuntu 16.04 on a x86_64 machine (Intel i3 5th generation) and take the latest GCC releases from http://ppa.launchpad.net/ubuntu-toolchain-r/test/ubuntu. Before the PPA released GCC 9.1 around May 21, I already built GCC 9.1 from the tarball when it was announced for the very first time earlier this month. For my personal GCC build, I install it in my personal directory, using no root privilege throughout the building and installation process. The building was done using GCC 8 that was obtained from the PPA. Build dependencies were obtained earlier by obtaining the build dependencies of the GCC 8 (aptitude build-dep gcc-8) plus installing the multilib packages of zlib (aptitude install lib32z1-dev libx32z1-dev), which is required due to following GCC 8 configure switch `--with-system-zlib'. The configure command was: ../gcc-9/configure --prefix=/home/eus/TEMPORARY/gcc-9 --srcdir=/home/eus/TEMPORARY/buildzone/gcc-9 --program-suffix=-9 --enable-languages=c,c++,objc,obj-c++,d,fortran,go --with-gcc-major-version-only --enable-shared --enable-linker-build-id --without-included-gettext --enable-threads=posix --enable-nls --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-vtable-verify --enable-libmpx --enable-plugin --with-system-zlib --with-target-system-zlib --enable-objc-gc=auto --enable-multiarch --with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32,m64,mx32 --enable-multilib --enable-offload-targets=nvptx-none --without-cuda-driver --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu. The configure switches follow those of the GCC 8. I then happened to compare the compilation times of my GCC-9 and that of the PPA on this C++ software: http://git.savannah.nongnu.org/cgit/tice.git/tree?id=8e6aa4c08574f7bf34908aa26ca58209edf3b7cc, specifically, by entering directory `tests' and executing the command: time ./test '^v1_gcc_test$'. This tests for many test units and uses my GCC-9 because the g++ command comes earlier in the PATH. To use the PPA one, add `/usr/bin/' to the g++-9 command found in file `v1_gcc_test' in the directory `tests'. The timing results showed that my GCC-9 is slower by about 15%: My GCC-9: real 5m51.732s user 0m26.727s sys 0m2.973s PPA GCC-9: real 4m51.352s user 0m22.364s sys 0m3.041s To have some hint, I used `-ftime-report' on one of the test units as follows: time g++-9 -std=c++14 -Wfatal-errors -pedantic-errors -o/dev/null v1/test-v1_internals_program.cpp -ftime-report (to use the PPA compiler, use `/usr/bin/g++-9' instead of `g++-9'). The results are attached (mine2.txt for my GCC-9, ppa2.txt for the PPA one), but I cannot see any clue there other than the fact that my GCC-9 is indeed slower. To find out the cause, I rebuilt the PPA GCC-9 from its source (apt-get source gcc-9; cd gcc-9-9.1.0; debuild). Because I forgot to use the switches `-us -uc' for debuild, the GCC build process itself was successful but the debuild process itself ended with signing failure. Nevertheless, the DEB files were produced, and I installed only the following ones, which were required after the PPA GCC-9 had been purged: libstdc++-9-dev_9.1.0-2ubuntu2~16.04_amd64.deb libgcc-9-dev_9.1.0-2ubuntu2~16.04_amd64.deb cpp-9_9.1.0-2ubuntu2~16.04_amd64.deb gcc-9_9.1.0-2ubuntu2~16.04_amd64.deb g++-9_9.1.0-2ubuntu2~16.04_amd64.deb. This does not change the situation. So, I manipulated the DEB build rules as follows: 1. Removing custom flags, which is done by setting variable `pass_vars' to empty in file `rules2'. 2. Removing the following patches from `rules.patch': gcc-default-fortify-source gcc-default-relro testsuite-hardening-format testsuite-hardening-printf-types testsuite-hardening-updates testsuite-glibc-warnings gcc-as-needed libgomp-kfreebsd-testsuite go-testsuite gcc-ice-dump gcc-ice-apport. 3. Invoking debuild as follows: DEB_BUILD_OPTIONS='nolang=jit,nvptx,ada,go,brig,d,fortran,objc,obj-c++,hppa64,biarch nocheck' debuild -J4 -us -uc -b Once debuild is done, I installed the aforementioned DEB files and found out that the installed /usr/bin/g++-9 still compiles faster as before. So, I have failed to identify the factor in the PPA build process that makes the resulting compiler faster than mine, which was built from the release tarball using configure & make. Any idea how to find the factor that results in a faster compiler? Is it really the build process or the way the resulting compiler is installed that gives the speed up? For example, does symbol stripping have any effect (I tried already to strip all symbols out of the executables found in my GCC-9 installation with `strip -s' but to no avail)? Perhaps some compiler libraries are installed in a particular way in Ubuntu? Thank you. -- Best regards, Tadeus
Time variable usr sys wall GGC phase setup : 0.01 ( 0%) 0.00 ( 0%) 0.02 ( 0%) 1352 kB ( 0%) phase parsing : 4.64 ( 92%) 1.22 ( 98%) 5.87 ( 93%) 297816 kB ( 96%) phase lang. deferred : 0.07 ( 1%) 0.02 ( 2%) 0.08 ( 1%) 3779 kB ( 1%) phase opt and generate : 0.33 ( 7%) 0.01 ( 1%) 0.34 ( 5%) 6794 kB ( 2%) |name lookup : 0.52 ( 10%) 0.22 ( 18%) 0.57 ( 9%) 6052 kB ( 2%) |overload resolution : 1.01 ( 20%) 0.23 ( 18%) 1.25 ( 20%) 44573 kB ( 14%) garbage collection : 0.14 ( 3%) 0.00 ( 0%) 0.15 ( 2%) 0 kB ( 0%) callgraph construction : 0.32 ( 6%) 0.00 ( 0%) 0.33 ( 5%) 6320 kB ( 2%) preprocessing : 1.02 ( 20%) 0.21 ( 17%) 1.36 ( 22%) 96013 kB ( 31%) parser (global) : 0.52 ( 10%) 0.20 ( 16%) 0.60 ( 10%) 34744 kB ( 11%) parser struct body : 0.22 ( 4%) 0.06 ( 5%) 0.22 ( 3%) 10174 kB ( 3%) parser function body : 0.03 ( 1%) 0.01 ( 1%) 0.06 ( 1%) 5109 kB ( 2%) parser inl. func. body : 0.02 ( 0%) 0.02 ( 2%) 0.04 ( 1%) 884 kB ( 0%) parser inl. meth. body : 0.06 ( 1%) 0.01 ( 1%) 0.10 ( 2%) 3188 kB ( 1%) template instantiation : 2.50 ( 50%) 0.66 ( 53%) 3.10 ( 49%) 144149 kB ( 47%) constant expression evaluation : 0.19 ( 4%) 0.06 ( 5%) 0.30 ( 5%) 7303 kB ( 2%) final : 0.01 ( 0%) 0.00 ( 0%) 0.00 ( 0%) 16 kB ( 0%) symout : 0.01 ( 0%) 0.01 ( 1%) 0.02 ( 0%) 0 kB ( 0%) initialize rtl : 0.00 ( 0%) 0.01 ( 1%) 0.00 ( 0%) 12 kB ( 0%) rest of compilation : 0.00 ( 0%) 0.00 ( 0%) 0.01 ( 0%) 25 kB ( 0%) TOTAL : 5.05 1.25 6.31 309751 kB
Time variable usr sys wall GGC phase setup : 0.01 ( 0%) 0.00 ( 0%) 0.02 ( 0%) 1352 kB ( 0%) phase parsing : 4.23 ( 91%) 1.16 ( 98%) 5.39 ( 92%) 297792 kB ( 96%) phase lang. deferred : 0.06 ( 1%) 0.01 ( 1%) 0.07 ( 1%) 3779 kB ( 1%) phase opt and generate : 0.35 ( 8%) 0.01 ( 1%) 0.35 ( 6%) 6794 kB ( 2%) |name lookup : 0.58 ( 12%) 0.07 ( 6%) 0.65 ( 11%) 6048 kB ( 2%) |overload resolution : 0.83 ( 18%) 0.21 ( 18%) 1.02 ( 17%) 44573 kB ( 14%) garbage collection : 0.14 ( 3%) 0.00 ( 0%) 0.15 ( 3%) 0 kB ( 0%) callgraph construction : 0.34 ( 7%) 0.00 ( 0%) 0.34 ( 6%) 6320 kB ( 2%) preprocessing : 0.97 ( 21%) 0.21 ( 18%) 1.19 ( 20%) 96012 kB ( 31%) parser (global) : 0.34 ( 7%) 0.21 ( 18%) 0.57 ( 10%) 35774 kB ( 12%) parser struct body : 0.19 ( 4%) 0.08 ( 7%) 0.24 ( 4%) 10660 kB ( 3%) parser function body : 0.06 ( 1%) 0.02 ( 2%) 0.06 ( 1%) 4085 kB ( 1%) parser inl. func. body : 0.02 ( 0%) 0.02 ( 2%) 0.04 ( 1%) 884 kB ( 0%) parser inl. meth. body : 0.06 ( 1%) 0.03 ( 3%) 0.04 ( 1%) 2676 kB ( 1%) template instantiation : 2.28 ( 49%) 0.56 ( 47%) 2.90 ( 50%) 144144 kB ( 47%) constant expression evaluation : 0.22 ( 5%) 0.03 ( 3%) 0.23 ( 4%) 7303 kB ( 2%) post expand cleanups : 0.01 ( 0%) 0.00 ( 0%) 0.00 ( 0%) 4 kB ( 0%) integrated RA : 0.00 ( 0%) 0.00 ( 0%) 0.01 ( 0%) 289 kB ( 0%) symout : 0.01 ( 0%) 0.01 ( 1%) 0.04 ( 1%) 0 kB ( 0%) rest of compilation : 0.00 ( 0%) 0.01 ( 1%) 0.00 ( 0%) 25 kB ( 0%) TOTAL : 4.65 1.18 5.83 309727 kB