Does C# compiler /optimize command line option affect JITter?

Go To StackoverFlow.com

5

I've been reading Eric Lippert's article about the /optimize command line option of the C# compiler. The article describes what kind of optimizations the compiler performs. However it remains unclear to me if this option affects JIT optimization as well. It is not unthinkable, that this option would make the compiler to emit some metadata, that jitter can understand to change "optimization mode". Is there any reference that can confirm or otherwise if this option does indeed affect JITter?

2012-04-04 01:13
by Andrew Savinykh
The JIT compiler doesn't optimize when you're debugging. I'm not sure whether /optimize affects it - svick 2012-04-04 01:42


5

Is there any reference that can confirm or otherwise if this option does indeed affect JITter?

According to Jeffrey Richter in his CLR via C# book, 3rd edition (chapter 1, page 13), it does. The /optimize+ switch will result in optimizations for C# IL code, as well as the native code generated by the JIT compiler. As to how it actually does that, I'm not sure. My wild guess is that it might have something to do with the CorDebugJITCompilerFlags enumeration.

2012-04-04 02:40
by Bryan Crosby
Your guess is a good one - Eric Lippert 2012-04-04 06:01