views:

106

answers:

2

Hi, I want to know compiler optimization strategies for generating optimized object code for my c++ app in Visual studio. Currently i am using default settings.

+2  A: 

In short: the main things you would want to play around with are the /O1 and /O2 flags. They set the optimization to either minimize size or maximize speed.

There are a bunch of other settings but you don't really want to be playing around with these unless you really know what you are done and have already measured, profiled and figured out that changing compiler settings is the best way to get better perf or smaller size.

Full link at: http://social.msdn.microsoft.com/forums/en-us/vcgeneral/thread/8931B453-6B0D-46C6-B2C6-EE2BEA2FFB76

obelix
Quoting the salient points of the page linked to saves people *having* to click the link and guards against link rot.
ChrisF
@ChrisF - cleaned up.
obelix
+1 - I like your suggestion about profiling before using the other optimization levels.
James Black