tags:

views:

269

answers:

1

When you write an application in C#, and then run it, will it not be compiled again next time it's run, or everything that's used is gonna be recompiled every time the application starts up?

How does JIT compiling works for caching?

+3  A: 

For any DLL that is not in the ngen'd, every time you run the application, it will re-JIT the code that is used. There is no caching of the JIT code in between runs of the same non-ngen'd DLL.

EDIT Cleared up a mistake with GAC and NGEN

JaredPar
As far as I know, NGEN storage and GAC are two different things. NGEN makes a little sense without GAC, but GAC doesn't replace NGEN.
Michael Damatov
To someone who apparently asks a beginner question this answer is pretty full of very specialized terms :). And ngen doesn't exactly do "pre-JIT" as it can't do any optimization based on runtime behavior.
Joey
@Toro, you are correct. I mis-remembered that GAC'ing forced an ngen but I think I was incorrect about that.
JaredPar
Yeah with ngen, you lose runtime optimizations.
Joan Venge
@Joan: you don't lose all optimizations, just some...
ShuggyCoUk