问题
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.
What is the default JIT with which .NET runs in deployment server?
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?
回答1:
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.
回答2:
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.
来源:https://stackoverflow.com/questions/11394345/how-to-change-the-type-of-jit-i-want-to-use