GCC runtime profiling optimization


klapse

Central Scrutinizer
Joined
Aug 30, 2012
Messages
1,932
Location
Germany
GCC has the ability to profile a program's runtime behaviour and optimize based on the results.


First one compiles with -fprofile-generate, then copies some profiling files to the runtime directory, then runs the program, then copies generated profile files back to the development system, then recompiles with -fprofile-use.


Has anyone done this with cdevtools? Seen any performance improvements?
 
Profile-guided optimization (PGO) is quite often a pain in the ass (PITA :D ).


You have to create a profile that covers all important code paths, the instrumented exe is sloooooooooow, and it makes your build process more complicated with an iteration.


Gains are not interesting when the code has been statically optimized before, so I'd advise to go through the classical route of optimization : profile-optimize loop.
 
Last edited by a moderator:
I thought it was very nice to get a 10-20% performance boost in UAE and MyPaint without touching the code. Some of us arent skilled enough to optimize code by hand :/
 
Wow, if you got 10-20% gain, I must say it is definitely worth it!


It wasn't my experience on my tests, so it definitely depends on the code base
 
Last edited by a moderator:
edit: deleted accidential double post
 
Last edited by a moderator:
Most of my tests did not show much improvement, but on mypaint it was drastic and much improved the user experience. Also on uae it made the difference between glitchy and 25 fps on the 330 MHz ARM1136 (omap 2)
 
I've tried similar optimizations, on other platforms, using a Code Warrior based tool chain, and I didn't experience any performance gains. This was running on a code base that had already received reasonable amounts of manual optimizations, and carefully selected compiler flags. At the time of trying it out, my final verdict was the extra problems it causes in the build process were not worth it, unless the gains were somewhat reasonable.


If you have an application that hasn't been through any rounds of optimization, doing a few profiles normally highlights a bunch of areas that can be optimized relatively easily.


Of course different projects, didn't sized teams and so on can have serious affects on how development time is best spent (and ultimately everything boils down to development time, time spent doing task A can't be spent doing task B.


I would be interested to hear if anyone else does play around with the GCC runtime profiling optimization though, the gains posted above are certainly higher than I would have guessed (but it really would have been somewhat of a guess for me).


Steve
 
Last edited by a moderator:
Back
Top