Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the effect of "Suppress JIT optimization on module load" debugging option?

What is the effect of the "Suppress JIT optimization on module load" debugging option?

I have recently had to turn it off to deal to be able to successfully debug an app that uses a COM component.

What do I risk by turning it off?

like image 364
Paul Lassiter Avatar asked Sep 03 '12 07:09

Paul Lassiter


People also ask

What is optimize code in Visual Studio?

You set the Optimize option from Build properties page for your project in Visual Studio. Optimize also tells the common language runtime to optimize code at run time. By default, optimizations are disabled. Specify Optimize+ to enable optimizations.

How do I disable optimization in Visual Studio 2017?

Open the project's Property Pages dialog box. For details, see Set C++ compiler and build properties in Visual Studio. Select the Configuration Properties > C/C++ > Optimization property page. Modify the Optimization property.

How to suppress JIT optimization on module load in Visual Studio?

To find the Suppress JIT optimization on module load (Managed only) option, select Tools > Options, and then select the General page under the Debugging node. When should you check this option: Check this option when you downloaded the DLLs from another source, such as a nuget package, and you want to debug the code in this DLL.

Where is the'suppress JIT optimization'option?

To find the Suppress JIT optimization on module load (Managed only) option, select Tools > Options, and then select the General page under the Debugging node. When should you check the 'Suppress JIT optimization' option?

Should I disable JIT optimization?

Disabling optimization may make it easier to debug some problems, although at the expense of performance. If you are using Just My Code, suppressing JIT optimization can cause non-user code to appear as user code ("My Code").

What are the disadvantages of JIT (Just in time) debugging?

If the mapping is less direct, debuggers are frequently unable to tell you the value of local variables, and code stepping and breakpoints might not work as you expect. For more info on JIT (Just In Time) debugging, read this documentation.


2 Answers

Suppressing JIT optimization means you are debugging non-optimized code. The code runs a bit slower because it is not optimized, but your debugging experience is much more thorough. Debugging optimized code is harder and recommended only if you encounter a bug that occurs in optimized code but cannot be reproduced in the non-optimized version.

If you clear the Suppress JIT optimization on module load option, you can debug optimized JIT code, but your ability to debug may be limited because the optimized code does not match the source code. As a result, debugger windows such as the Locals and Autos window may not display as much information as they would if you were debugging non-optimized code.

like image 85
Vitaliy Nesterenko Avatar answered Oct 14 '22 22:10

Vitaliy Nesterenko


It means that JIT code will not be optimized for debugging. For example:

private int Add(int x, int y)
    {
        int notUsed = 2;
        return x + y;
    }

in this code notUsed variable will be excluded fro JIT code by optimization as this code is not required. If you start debugging optimized code it may look like not the code you have written (but will do the same). Another example of optimization is methods inlining.

like image 24
petro.sidlovskyy Avatar answered Oct 14 '22 22:10

petro.sidlovskyy