Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Suppress JIT optimization on module load (managed only)

If I run a release build in VS but WITH debugger attached. So I can set breakpoints and investigate the optimized code disassembly. Usually, in order to see all optimizations I need to run WITHOUT a debugger attached and detach to the running proccess.

Does unselecting the "Suppress JIT optimization on module load (managed only)" switch in Visual Studio is sufficient to bring the same result? By 'same result' I mean: same (optimized) machine instructions as by starting without debugger attached?

I heard the JIT compiler would only utilize ALL optimization options, if the assembly was a release build and NO debugger was attached. Now I wonder if this switch could make my debugging / inspecting live easier?

like image 759
JGrand Avatar asked Mar 05 '12 10:03

JGrand


People also ask

How do I reset Visual Studio exceptions?

To set Visual Studio debugger options, select Tools > Options, and under Debugging select or deselect the boxes next to the General options. You can restore all default settings with Tools > Import and Export Settings > Reset all settings.

How do I enable debugging in Visual Studio?

In the Visual Studio toolbar, make sure the configuration is set to Debug. To start debugging, select the profile name in the toolbar, such as <project profile name>, IIS Express, or <IIS profile name> in the toolbar, select Start Debugging from the Debug menu, or press F5.


1 Answers

There is small differences in IL between DEBUG and RELEASE builds, so you do want to use RELEASE build in this case (i.e. all Debug.XXX calls are compiled out in Release case).

Un-checking "Suppress JIT optimization on module load (managed only)" should allow JIT do do optimizations as if no debugger attached. I'm not aware of any differences between these 2 cases.

like image 171
Alexei Levenkov Avatar answered Sep 17 '22 13:09

Alexei Levenkov