简体   繁体   中英

Visual C++ compiler optimization

I've recently migrated from Dev-c++ to Visual C++ 2010, and found it much better within all aspects but one. When I compile and execute the code in Dev-c++ with the best-optimization option toggled, the compile time is greatly reduced, almost by half ( mingw32 ), but I can't seem to find any optimization options in Visual C++ 2010. How can I tell the compiler to optimize the code?

Right click your project, pick "Properties". Now make sure that your current configuration is "Release". In the left part of the window, you should see a tree view with different categories. Optimization options are split amongst the C/C++ and linker entries.

Also, keep in mind, that optimization means the resulting binary is optimized. NOT actually building the binary. The speed gain might be explained due to not having to add debug code etc. but in general, I'd more likely expect building a release version with optimizations to take longer than creating a debug build.

I only have VS C++ Express, but it should be the same in the full version...

In the "Project" menu select " Properties". This will open a dialog with all project settings. Look around at the different options available and you will soon find where to change optimization.

Also remember that when building in release mode, some optimizations are alredy turned on.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM