6

I am trying to understand how I can configure the type of JIT I want to use.

Say, I am aware that there are 3 types of JIT (Pre, Econo and Normal). But have the following curious questions.

  1. What is the default JIT with which .NET runs in deployment server?

  2. Do we have the flexibility to change the settings to use either pre or econo if the default is normal. If so where I can change this?

Not sure, if this setting is in machine.config or something?

svick
  • 236,525
  • 50
  • 385
  • 514
Jasmine
  • 5,186
  • 16
  • 62
  • 114
  • 2
    Where did you find out about these three types of JIT in .Net? Can you give a link? – Jonathan Rupp Jul 09 '12 at 11:58
  • Neither seen nor heard of types of JIT in .net. JIT or no JIT (NGen) is it as far as I'm aware. Unoptimised output is possible, based on past experience with other compilers, that's a path I'd leave other "fools" to tread. – Tony Hopkinson Jul 09 '12 at 12:04
  • You should be good as long as you do the following: 1) build your code in the "Release" configuration (or more specifically, with the Optimize Code setting enabled) and 2) run your code with the most recent version of the .NET framework you are able to use. Everything else will lie in how well the code is written and the hardware running things. – Sam Harwell Jul 09 '12 at 14:55
  • @JonathanRupp: Also Tony Hopkinson: I am really surprised to see your response. I am very sure you both folks are well experienced in .NET and I am just a newbie. But this type of JIT is a very common thing that I am aware and many like me are aware and even been asked in interviews. Today, I found the interviewer asked me how do I use particular type of JIT. I couldn't answer that. Please see this web link/site (Your Microsoft Website) :) http://forums.asp.net/t/1703160.aspx/1 – Jasmine Jul 09 '12 at 16:57
  • @TonyHopkinson: Also there are many websites that say about these 3 types of JIT. I am really surprised to see many of you folks reply :S Am I in the dream world ? http://www.google.co.in/#hl=en&output=search&sclient=psy-ab&q=types+of+jit&oq=types+of+jit&gs_l=hp.3...819.2370.0.4340.12.10.0.0.0.0.691.1740.4-1j2.3.0...0.0.4RxODLqj4QQ&pbx=1&bav=on.2,or.r_gc.r_pw.r_qf.,cf.osb&fp=df4f14c76f997e44&biw=1366&bih=636 – Jasmine Jul 09 '12 at 16:58
  • @280Z28: Where is the "Optimize Code" setting available ? And I am not behind optimizing, but looking for understanding, by default .NET framework comes with which JIT and if we have option to change in Machine.Config file (Please dont presume machine.config file only but may it be registry/anywhere else or any other config.) – Jasmine Jul 09 '12 at 17:02
  • @Divine It's a setting in C# project properties, and selected by default for the "Release" configuration. When you run your application in .NET, everything will be configured to run well by default. You can *disable* optimizations by running your program within a debugger, but the only way to change which JIT you want to use is to run your program with a different release of .NET (basically a pick between 2.0 or 4.0). – Sam Harwell Jul 09 '12 at 17:09
  • I've been doing .net a while, took courses, read books, never heard of it on those terms and to be quite honest they look more like phases to me. I'd figure anyone who wanted to mess with this in a production environment to be some sort of numpty. – Tony Hopkinson Jul 09 '12 at 21:07
  • @TonyHopkinson: No not really changing the JIT, but exploring if there is a way to change or what these stuffs all about. Well :) – Jasmine Jul 10 '12 at 03:39

2 Answers2

9

I never heard of "Econo jit" before. I do see google links, they all point to old articles that talk about .NET 1.x. The "econo" part seems to be achieved by not optimizing the generated machine code as much and by skipping IL verification.

This option certainly doesn't exist anymore since .NET 2.0. There is only one type of jitter, IL is always verified but optimization can be turned off. Like it is in the Debug build of your program, the [Debuggable] attribute controls it. There are different kinds of jitters, Microsoft supplied ones can target an x86, x64 or ARM processor. But that's a logical distinction, different processors require different machine code. Jitter selection is automatic. And turning off optimization makes little sense.

"Pre jit" still exists, you precompile your assemblies with ngen.exe. It uses the exact same jitter as the one that generates code at runtime. It improves warm start time for your program, it is not always the best solution since the generated code isn't quite as efficient and it slows down cold starts. Using ngen.exe requires writing an installer that runs it at install time on the user's machine.

Hans Passant
  • 922,412
  • 146
  • 1,693
  • 2,536
  • Mr Hans, please take a look at this link below. Official ASP.NET Website forum ;) http://forums.asp.net/t/1703160.aspx/1 I am surprised, btw I will take a look at your answer, thank you – Jasmine Jul 09 '12 at 16:59
  • Could you please explain "turning off optimization" ? How do I achieve it ? I see in google that Debug mode generates optimized code but not release mode. Why and how :( – Jasmine Jul 09 '12 at 17:06
  • It is in my answer, DebuggableAttribute. Specify DebuggingModes.DisableOptimizations to suppress optimization. Don't use it. – Hans Passant Jul 09 '12 at 17:07
0

Do you mean change the complier options for the JIT compiler like this?

Is there any way to change the .NET JIT compiler to favor performance over compile time?

Or do you mean use an entirely different complier to the one that ships with .net? I'm not aware this is possible. For example if you have mono installed beside .net you need to explicitly launch with mono, it's not something the running .net assembly can decide.

Community
  • 1
  • 1
James Gaunt
  • 14,631
  • 2
  • 39
  • 57
  • James thank you for the response, I have already had a look at the link you posted before I write here, but I didn't much understood. My question is, what is the type of JIT .NET comes with by default and is there a flexibility to change the jit to another in any config files (Say machine.config) etc ? – Jasmine Jul 09 '12 at 11:48