JIT vs NGen - what is the difference?

后端 未结 5 2138
青春惊慌失措
青春惊慌失措 2020-12-13 04:35

So when CLR runtime load a .NET assembly, it compiles it into machine native code. This process is called JITing. NGen is also the process of compiling .NET assembly into na

5条回答
  •  轻奢々
    轻奢々 (楼主)
    2020-12-13 05:15

    JIT is only done per-method; it doesn't JIT everything... Only the bits you need. Of course this has a small but measurable hit the first time into a method (plus generics etc). NGEN does this work up-front, but must be done on the same platform/architecture etc - essentially that machine. This also means adding it to the GAC etc, which may need higher access.

    In many cases, JIT is fine, especially if the app is open for a long time (web servers, for example).

提交回复
热议问题