Page 1 of 1

Profile-guided optimization

Posted: Sat Oct 20, 2012 12:59 am
by attitude
Hello

I am new to codelite, MinGW and GCC but I have experiences with Microsoft Visual C++.
I need to run my code as fast as possible, in certain cases it’s preferable to compile with GCC because it would run faster then. Using PGO within Visual Studio IDE is very easy, but does codelite provide any facility this task to ease up things? I have freshly installed the latest codelite on windows. Do I need to download any library for that matter? How can I build my binaries as fast as possible? Please guide me through this. Step by step. Thanks.

Re: Profile-guided optimization

Posted: Sat Oct 20, 2012 9:51 am
by spaces
Look up gprof. Then you modify your code accordingly.

Re: Profile-guided optimization

Posted: Sat Oct 20, 2012 11:10 pm
by eranif
You can use -pg as well ( make sure to add it both in linker and compiler pages )

You can also use the CallGraph plugin of codelite

Eran

Re: Profile-guided optimization

Posted: Sun Oct 21, 2012 12:19 am
by attitude
-pg solved my problem. Thanks!
As for speedy builds, any other compiler switch should I consider? I use -pg;-O3;-fexpensive-optimizations;-Wall ; is that good? I know GCC has other options not available from IDE and latest versions add even more options. Any suggestion? Also I'd like to know what settings you generally use for the best performance.

Re: Profile-guided optimization

Posted: Mon Oct 22, 2012 9:19 pm
by eranif
I usually use these settings:

Debug:

Code: Select all

g++ -g -O0 -Wall ...
Release:

Code: Select all

g++ -O3 -Wall ...
Nothing more.

I myself I don't use -pg

Instead, when I want analyze code (memory or performance) - I use valgrind (Linux only)
valgrind has several tools (the default tool is the memory leak tool, you can use cachegrind for performane)

There are also some nice tools that loads varlgrind into a very nice visual editor

Eran