May 20, 2012

How to optimize your code in VC++

Last time I have talked about the optimization of the running code but didn't show how to do that. Here it is:


  • open you project's property and change to the C++/C


make sure that "Debug Information Format" is chosen to be "Program Databas(/Zi)

  • change to "Optimization" tab, 

choose Full Optimaization(/Ox) or Maximize Speed(/O2).



  • change to " Code Generation" tab


choose "Default" for "Basic Runtime Checks"

A word of caution, optimization is good for running but the debug information is hard to understand if you're in the process of debugging your code. So this optimization should apply after you find no problems in building and want to run the program for test.

No comments: