Hi Willy...
Mostly I'd filed this discussion away in my head, but lately I've been
coming back to it.
I've been testing Purify's profiler on some of our .Net applications, and
I've been surprised how much of the time it reports going to the JIT
processes and how much time it says keeps going to JIT even though I run the
same test script multiple times running. That's got me thinking more about
going in the direction you mentioned here.
I've been reading up on Ngen and I've got a couple of questions:
1) it sounds like ngen has to be run on an msil assembly on the deployment
environment, to get it in the cache. Is that correct? It sounded from your
post like you were producing a binary at build process and sending that
without the msil
2) There were a number of (old) posts saying that the JIT can do so much
better optimization because it has so much more data at runtime. In practice
how many of those runtime tweaks end up paying off so much? There were a few
skeptics about the idea that JIT will produce that much better code, but at
least a few years ago it seemed like msil was the Microsoft line.
Thanks
Mark
> Hi Willy...
>
[quoted text clipped - 15 lines]
> post like you were producing a binary at build process and sending that
> without the msil
No, when I'm refering to MSIL I'm talking about what is now called the
"AnyCPU" platform compiler option, this option was called msil in previous
versions of VS and the managed code compilers.
What I meant was that I'm only deploying X86 or X64, never "AnyCpu" builds.
You are right, you have to ngen on the target machine, you can't deploy a
pre-jitted assembly, simply because the JIT may produce less optimized or
simply invalid code for the target (for instance produce SSE2 while the
target CPU doesn't support it).
> 2) There were a number of (old) posts saying that the JIT can do so much
> better optimization because it has so much more data at runtime. In
[quoted text clipped - 4 lines]
> at
> least a few years ago it seemed like msil was the Microsoft line.
Don't know for sure what you mean here, but it's obvious that a JIT can
produce "better code" than a native code compiler, because it know exactly
what processor type and family he's running on when compiling the actual
code.
Willy.
Mark - 19 Mar 2008 19:46 GMT
Thanks for responding
> "Mark" <mmodrall@nospam.nospam> wrote in message
> > 2) There were a number of (old) posts saying that the JIT can do so much
[quoted text clipped - 10 lines]
> what processor type and family he's running on when compiling the actual
> code.
Sorry I wasn't more clear. I found a number of articles ca. 2002-2004
arguing against the use of NGEN because the JIT compiler "would know more
about the execution environment and be able to optimize better" (like being
able to merge string pools across an app domain) than NGEN.
A lot of the things that were mentioned that the jit could do that ngen
couldn't seemed more like theoretical benefits than big, concrete wins, and I
didn't see anything that looked like such an obvious win that it paid for the
hit you take with the jit re-compiling everything at runtime. As I said, I
was surprised how long the JIT stayed the #1 processor time consumer in the
Purify profiling.
Thanks
Mark