PDA

View Full Version : g++ optimization



Krish_ng
31st July 2007, 12:44
I hav developed an application which needs to be further optimized ..Memory and execution time is the constraint...Can anybody suggest some of the g++ options that can be used to optimize the execution time of the application..

marcel
31st July 2007, 12:50
g++ has a few level of optimizations.
Try and compile with -O3.
Also there is a flag for fast math( -ffast-math ), but I don't know if there is an accuracy trade off.

Make sure you use set the -march option to a model that is closer to what you got.

Regards

Krish_ng
1st August 2007, 05:17
Is it possible to use march option for an application which need to executed on a device.Any ideas

marcel
1st August 2007, 10:34
Take a look at this, since you did not specified the architecture.
http://gcc.gnu.org/onlinedocs/gcc/Submodel-Options.html#Submodel-Options

Regards

Michiel
1st August 2007, 10:36
The march option optimizes for a specific architecture. If you want the application to run quickly on any architecture, don't specify that option.

marcel
1st August 2007, 10:37
The march option optimizes for a specific architecture. If you want the application to run quickly on any architecture, don't specify that option.
Well, he was asking about a single device, so it is a pretty good idea to compile it for that specific architecture.

Regards

tonylin0826
31st August 2012, 10:01
Excuse me, could you teach me how to compile with -O3? Where can i set it?