Faster debugging in Visual Studio [a simple trick]

Running in debug mode can be incredibly slow in visual studio, and running in release mode will give you almost zero debugging options.

There are a few steps that allow you to get an in-between with decent speed and decent debugging:

  1. Click the little arrow next to the dropdown that let’s you choose Debug/Release mode
  2. Select “Configuration Manager”
  3. In the same row as your project, click “debug/relase” and select “new”
  4. Name it “Release-Dbg”, select “copy settings from … Release” and tick “Create solution configurations”

Half way there. now right click your project in solution explorer and go into the project properties (where you change compiler settings and similar stuff)

  1. Select “Release-Dbg” as configuration and “All platforms” as platform
  2. C++ > General: Change Debug Information Format to C7 compatible
  3. Linker > General: Enable Incremental Linking to NO
  4. Linker > Debugging: Generate Debug Info to YES
  5. Linker > Optimization: References to YES (/OPT:REF)
  6. Linker > Optimization: Enable COMDAT folding to YES (/OPT:ICF)

Congrats! You can now use “Relase-Dbg” to run your build. It will be speedy, and debuggable.

Instructions are mostly based on this Article: https://docs.microsoft.com/en-us/cpp/build/how-to-debug-a-release-build?view=vs-2019

9 Likes

Thanks! Worked like a charm.

The options for step 4 have changed, now it is called:

  1. Linker > Debugging: Generate Debug Info to Generate Debug Information (/DEBUG)
3 Likes

@kritzikratzi Hey, I’ve followed your instructions, but even though I create Release-Dbg as a configuration and select it in the drop-down menu; when I open Properties, the Configuration is is shown as Active(Release) and Release-Dbg is not an option there… so following the rest of your instructions is just changing the settings for my Release configuration. Running it with shift-f5 throws a bunch of errors, but running with f5 seems to work well.