Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

c#

compilation

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?

like image 279
Andrew Savinykh Avatar asked Apr 04 '12 01:04

Andrew Savinykh


1 Answers

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.

like image 69
Bryan Crosby Avatar answered Sep 23 '22 15:09

Bryan Crosby