Saturday, August 01, 2009 6:06 AMI am working in VC++2005 Express Edition. I am nowadays trying to optimize my project. I wanted to know that what optimization settings must I keep to achieve better optimization. I wanted to know about what best setting I should apply in C/C++ ->OPTIMIZATION and Linker -> OPTIMIZATION.
Saturday, August 01, 2009 8:51 AMIt depends on your application actually. There is no "best optimization". You can optimize your app in some different ways, and each of those ways has its own advantages and disadvantages.
First of all, you can read about any compiler option in msdn where the full information is presented.
So, C++ -> Optimization
Optimization: Use Full optimization (/Ox) for more aggressive optimization.
Options /O2 - Maximize speed and /O1 - Minimize size I think are clear. /O2 tries to maximize the execution speed of your app and /O1 tries to minimize the size of your app.
Inline function expansion: /Ob1 Only __inline tells compiler to make inline only functions that marked with 'inline' keyword. The /Ob2 Any suitable tells compiler to make inline any function that can be inline. In general it is not a good idea to make all functions inline. So it depends on. I recommended to leave the 'Default' option.
Enable intrinsic function: /Oi Yes. This option enable intrinsic functions, using that compiler can generates faster, but possible large code. If the size of code doesn't matter set this option to Yes.
Favor Size or Speed: It's clear I think. Choose the option that suits your needs. If you want code to be faster, choose Speed, or if you want code to be smaller choose Size.
Omit frame pointers: OK, choosing Yes /Oy makes code more faster sometimes (actually makes functions calls faster). I usually use this option. More about this option you can read: here http://msdn.microsoft.com/en-us/library/2kxx5t2c%28VS.71%29.aspx
Enable Fiber-Safe optimization: This option is useful only if you use fibers or TLS. In this case you can choose Yes.
Whole Program Optimization: LTCG /Gl makes sometimes your code faster, but I don't know much about it. May be someone else tells us.
What's about Linker -> Optimization I usually don't use it, so I can't tell what's the ____ over there.
- Marked As Answer by Wesley Yao Friday, August 07, 2009 2:51 AM