>> Although interpreting is probably slower than executing jit'ed
code and pre-jit-ing will bloat your image to some extent. <<

It should also be noted that pre-jit-ing (or NGEN-ing) your code will
actually cause the code to run ever so slightly *slower* *today*. This
is due to the fact that certain optimizations cannot be done at install
time.

For example, it is not known what app domain the code will run in so
certain things like referencing static fields must always occur via
indirection in the case of NGEN'd code. The same code processed through
the JIT'er can eliminate the indirection since knowing what appdomain
the code executes in lets the JIT'er hard-code the address of the static
field into the generated x86 instructions.

However, there are definitely caveats to consider here. In V1, NGEN
simply calls the JIT to generate the x86 image. This will probably not
be the case in future implementations. If you consider, for example, the
difficulty involved in generating IA-64 instruction bundles in a JIT'er
(which is constrained by the amount of time it can "think") on IA-64
architectures there could very well be a significant perf boost in
NGEN-ing code. 

Like all things, your mileage will vary. Make sure that you test, and
test often. And be very careful about things that could invalidate your
test results. And be even more careful when you interpret your results -
make sure the thing you think you're observing is really the thing
you're observing.

HTH,

-John
http://www.iunknown.com

You can read messages from the DOTNET archive, unsubscribe from DOTNET, or
subscribe to other DevelopMentor lists at http://discuss.develop.com.

Reply via email to