How to change the type of JIT I want to use

旧街凉风 提交于 2019-12-09 18:03:00

问题


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?


回答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

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!