By default, the JIT happens every time, but it only happens for the
functions that are called. There's a tradeoff between the time it takes the
JIT to run and the time and overhead of opening another file and reading it
into memory. There's also the issue of tracking the environment (security,
etc.) of the method when it was JITted, and then comparing that with the
environment of the current program.
There is a tool named NGEN that can "pre-jit" an entire assembly for you as
a load optimization, and some of the BCL assemblies have that done. That
pre-jitted cache is only valid for the same environment, but the check is
done on a per-user basis. There is also another level of indirection in the
NGEN case, and the resulting code may be slightly less optimal.
Doing this on a per-function basis would be really complex.
--
Eric Gunnerson
Visit the C# product team at
http://www.csharp.net
Eric's blog is at
http://weblogs.asp.net/ericgu/
This posting is provided "AS IS" with no warranties, and confers no rights.