Profile-guided optimization

CodeLite installation/troubleshooting forum
attitude
CodeLite Curious
Posts: 2
Joined: Sat Oct 20, 2012 12:45 am
Genuine User: Yes
IDE Question: C++
Contact:

Profile-guided optimization

Post 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.
spaces
CodeLite Veteran
Posts: 67
Joined: Mon Aug 22, 2011 10:15 pm
Genuine User: Yes
IDE Question: c++
Contact:

Re: Profile-guided optimization

Post by spaces »

Look up gprof. Then you modify your code accordingly.
User avatar
eranif
CodeLite Plugin
Posts: 6373
Joined: Wed Feb 06, 2008 9:29 pm
Genuine User: Yes
IDE Question: C++
Contact:

Re: Profile-guided optimization

Post 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
Make sure you have read the HOW TO POST thread
attitude
CodeLite Curious
Posts: 2
Joined: Sat Oct 20, 2012 12:45 am
Genuine User: Yes
IDE Question: C++
Contact:

Re: Profile-guided optimization

Post 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.
User avatar
eranif
CodeLite Plugin
Posts: 6373
Joined: Wed Feb 06, 2008 9:29 pm
Genuine User: Yes
IDE Question: C++
Contact:

Re: Profile-guided optimization

Post 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
Make sure you have read the HOW TO POST thread
Post Reply