On 2017-06-01 15:59 +0800, Nan Xiao wrote: > Hi all, > > Greetings from me! > > My OS is ArchLinux, and on this Monday, I upgrade gcc from 6.3.1 to > 7.1.1 (both packages are released by ArchLinux). But after rebuilding > my program, I find the performance downgrades drastically. > > For single-thread version, the program which is built with "gcc 6.3.1" > would use ~85 seconds to process a transaction; while with "7.1.1", it > grows to ~115 seconds. > For multiple-thread version using OpenMP, the program which is built > with "gcc 6.3.1" would use only ~11 seconds to process a transaction; > while with "7.1.1", it grows to ~50 seconds. > > The compile and link flags are " -g -O2 -fopenmp -fprofile-arcs > -ftest-coverage -fPIC -std=gnu++11 ". > > I also download and build gcc 7.1 myself from > https://gcc.gnu.org/gcc-7/, the single-thread program can use ~95 > seconds, while OpenMP version still consumes ~50 seconds. So compared > to program built using gcc 6.3, the performance is very worse. > > I have checked the release note of gcc > (https://gcc.gnu.org/gcc-7/changes.html), but can't find some valuable > information. > > Could anyone give some comments? Thanks very much in advance! > > Best Regards > Nan Xiao Sadly, GCC has some annoying performance regressions. But I think at first you could change your compile flags: (1) "-fprofile-arcs" slows down your program since it add code into your program to record branch probabilities. If you want to optimize, use "-fbranch-probabilities". (See the man page of GCC.) (2) "-O2 -ftest-coverage" may produce strange coverage result. If you want to test coverage with gcov, it's better to disable all optimization (with -O0). Which package are you building? If it's open source, please send a link here and maybe someone can reduce it for a test case. Then the developers of GCC may fix the regression. But if possible I suggest you to create a test case (simple enough) by yourself and report it to <http://gcc.gnu.org/bugzilla>. And please tell us your architecture (i686 or x86_64). -- Xi Ruoyao <ryxi@xxxxxxxxxxxxxxxxx> School of Aerospace Science and Technology, Xidian University