Gambit King
Gambit King

Reputation: 483

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?

Upvotes: 4

Views: 18388

Answers (2)

Mario
Mario

Reputation: 36537

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.

Upvotes: 6

Some programmer dude
Some programmer dude

Reputation: 409422

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.

Upvotes: 0

Related Questions