Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to change the type of JIT I want to use

Tags:

c#

.net

jit

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?

like image 600
Jasmine Avatar asked Jul 09 '12 11:07

Jasmine


1 Answers

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.

like image 140
Hans Passant Avatar answered Sep 20 '22 00:09

Hans Passant