The Most Underused Compiler Switches in Visual C++, March 11, 2014 Microsoft's Visual C++ team explains the nine most underused switches and why you should make sure to include them in your build.
With Visual Studio 2012, we also introduced automatic vectorization feature in the compiler. The "auto-vectorizer" tries to make loops in your code run faster by automatically vectorizing your code that's to say, using the SSE instructions available in all current mainline Intel and AMD chips. Auto-vectorization is enabled by default. You don't need to request this speedup. You don't need to throw a compiler switch. You don't need to set environment variables or registry entries. You don't need to change your C++ code. You don't need to insert
#pragmas. The compiler just goes ahead and does it. It all comes for free.
So what does
/Qvec-report bring to the table? In order to always maintain functional correctness, the compiler is sometimes conservative and fails automatic vectorization for a loop. The
/Qvec-report provides diagnostic information about auto-vectorization, and is equipped with the following reporting levels:
/Qvec-report:1, Outputs an informational message for loops that are vectorized.
/Qvec-report:2, Outputs an informational message for loops that are vectorized and for loops that are not vectorized, together with a reason code.
If you use C++, it is likely that you care a lot about runtime performance. Recompiling with VS2012 and above brings you that added performance with automatic vectorization. To fine-tune those hot-spots in your application, try out
/Qvec-report. Sometimes, you can tweak the way you wrote a loop, allowing the compiler to then auto-vectorize it for you. For more information, see Jim Hogg's series of blogs on this topic.