https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71618
Bug ID: 71618 Summary: Improve C++ compilation by adding specific optimization flags Product: gcc Version: 4.4.2 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: Roger.Jeurninck at gmail dot com Target Milestone: --- Hi, I'm compiling C++ code together with gmock. Unfortunately this slows down the compilation for one file to 10 minutes (using -g -O0) Using one of the optimization levels (e.g. -O1) does improve the performance a lot to a little more than 1 minute. Unfortunately this is not the best solution as the code which is being compiled is being used for testing and debugging and optimization might hamper this. As a solution I try to pinpoint the optimization flag which does give this beneficial compilation performance. The strange thing I do notice now that proving 'g++ -O1' does not give the same result as providing the list of optimization flags belonging to -O1. So what am I missing here? ----------------- Commands used -------------- about 1m30s => g++ -O1 -c <preproc.ii> about 10m => g++ -fauto-inc-dec -fcprop-registers -fdce -fdefer-pop -fdelayed-branch -fdse -fguess-branch-probability -fif-conversion2 -fif-conversion -finline-small-functions -fipa-pure-const -fipa-reference -fmerge-constants -fsplit-wide-types -ftree-builtin-call-dce -ftree-ccp -ftree-ch -ftree-copyrename -ftree-dce -ftree-dominator-opts -ftree-dse -ftree-fre -ftree-sra -ftree-ter -funit-at-a-time -fomit-frame-pointer -c <preproc.ii> ----------------- gcc specs ------------------ gcc -v Using built-in specs. Target: sparc-sun-solaris2.10 Configured with: ../configure --prefix=/cadappl/gcc/4.4.2/gcc --enable-languages=c,c++,fortran,java --with-gmp-lib=/shared/caddev/wblanken/5.10/gcc_4.4.2/gcc/4.4.2/SunOS_5.10/cadenv_home/cadlib:/usr/lib:/usr/ccs/lib:/usr/dt/lib:/usr/openwin/lib --with-gmp-include=/shared/caddev/wblanken/5.10/gcc_4.4.2/gcc/4.4.2/SunOS_5.10/cadenv_home/cadinc --with-mpfr-lib=/shared/caddev/wblanken/5.10/gcc_4.4.2/gcc/4.4.2/SunOS_5.10/cadenv_home/cadlib:/usr/lib:/usr/ccs/lib:/usr/dt/lib:/usr/openwin/lib --with-mpfr-include=/shared/caddev/wblanken/5.10/gcc_4.4.2/gcc/4.4.2/SunOS_5.10/cadenv_home/cadinc --without-gnu-as --with-ld=/usr/ccs/bin/as --without-gnu-ld --with-ld=/usr/ccs/bin/ld --disable-nls Thread model: posix gcc version 4.4.2 (GCC)