Where is the .NET JIT-compiled code cached?

Memory. It can be cached, that’s the job of ngen.exe. It generates a .ni.dll version of the assembly, containing machine code and stored in the GAC. Which automatically gets loaded afterward, bypassing the JIT step. But that has little to do with why your program starts faster the 2nd time. The 1st time you have … Read more

Where is the .NET JIT-compiled code cached?

Memory. It can be cached, that’s the job of ngen.exe. It generates a .ni.dll version of the assembly, containing machine code and stored in the GAC. Which automatically gets loaded afterward, bypassing the JIT step. But that has little to do with why your program starts faster the 2nd time. The 1st time you have … Read more

Retrieve JIT output

While debugging your application in Visual Studio, you can right-click on a code where you have stopped (using breakpoint) and click “Go to Disassembly”. You can debug through native instructions. As for doing that with *.exe files on disk, maybe you could use NGen to generate native output and then disassemble it (although I never … Read more

What are the advantages of just-in-time compilation versus ahead-of-time compilation?

Greater portability: The deliverable (byte-code) stays portable At the same time, more platform-specific: Because the JIT-compilation takes place on the same system that the code runs, it can be very, very fine-tuned for that particular system. If you do ahead-of-time compilation (and still want to ship the same package to everyone), you have to compromise. … Read more

What is the size of methods that JIT automatically inlines?

HotSpot JIT inlining policy is rather complicated. It involves many heuristics like caller method size, callee method size, IR node count, inlining depth, invocation count, call site count, throw count, method signatures etc. Some limits are skipped for accessor methods (getters/setters) and for trivial methods (bytecode count less than 6). The related source code is … Read more