Home > Archive > microsoft.public.cert.exam.mcsd > June 2003 > Re: 70-316 NGen Assembly Deployment Question - Practice Exams vs. Reality





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author Re: 70-316 NGen Assembly Deployment Question - Practice Exams vs. Reality
DEK

2003-06-25, 2:23 am

In article < 03a801c33aa9$b3b232f0$a601280a
@phx.gbl>,
guycox@cox.nouspam.net says...
> I keep running across a question in the practice exams is
> something like -- Users complain about the slow start up
> performance..
>
> On of the answers is to NGEN the assembly and deploy a
> native image. NGEN places the native assembly in the
> application cache - I just ran a test building setup with
> the same assembly before and after the NGEN. The sizes
> are the same - I doubt that the native and the MSIL code
> sizes would be the same...
>
> I'm taking the exam on Friday -- So if the question comes
> up should I answer it the way the practice exams count as
> correct or do the right thing..
>


It depends if you want to pass or fail.
--
Thanks
DEK
Fluker

2003-06-25, 8:23 am

NGEN doesn't produce optimized "EXE"s. It is merely
profiling of application and it will install the image in .NET
Assembly Cache. It is machine independent and even if
you copy the same nGened exe to new location, you have
to ngen it again.
"Guy Cox" <guycox@cox.nouspam.net> wrote in message
news:03a801c33aa9$b3b232f0$a60
1280a@phx.gbl...
> I keep running across a question in the practice exams is
> something like -- Users complain about the slow start up
> performance..
>
> On of the answers is to NGEN the assembly and deploy a
> native image. NGEN places the native assembly in the
> application cache - I just ran a test building setup with
> the same assembly before and after the NGEN. The sizes
> are the same - I doubt that the native and the MSIL code
> sizes would be the same...
>
> I'm taking the exam on Friday -- So if the question comes
> up should I answer it the way the practice exams count as
> correct or do the right thing..



Butch

2003-06-25, 9:23 am

Xref: intern1.nntp.aus1.giganews.com microsoft.public.cert.exam.mcsd:21805

From
http://msdn.microsoft.com/library/e...ne
xe.asp


"The Native Image Generator creates a native image from a managed assembly
and installs it into the native image cache on the local computer. Running
Ngen.exe on an assembly allows the assembly to load and execute faster,
because it restores code and data structures from the native image cache
rather than generating them dynamically."

"A native image is a file containing compiled processor-specific machine
code."


"Guy Cox" <guycox@cox.nouspam.net> wrote in message
news:03a801c33aa9$b3b232f0$a60
1280a@phx.gbl...
> I keep running across a question in the practice exams is
> something like -- Users complain about the slow start up
> performance..
>
> On of the answers is to NGEN the assembly and deploy a
> native image. NGEN places the native assembly in the
> application cache - I just ran a test building setup with
> the same assembly before and after the NGEN. The sizes
> are the same - I doubt that the native and the MSIL code
> sizes would be the same...
>
> I'm taking the exam on Friday -- So if the question comes
> up should I answer it the way the practice exams count as
> correct or do the right thing..



Kline Sphere

2003-06-25, 11:23 am

> I doubt that the native and the MSIL code
>sizes would be the same...


Naturally you were comparing it against the image under the
assembly/native<dot net version> directory?
Wray Smallwood

2003-06-25, 1:23 pm

Answer the question the way they want you to.But you can always add a
comment to each question that will be fed back to Microsoft. For instance in
70-320, I commented on 2 questions that had errors in the question part.

But, all is not necessarily what it seems for ngen.

1. ngen can INCREASE the run time performance of frequently called
procedures. Yes! The reason is that when ngen performs it's JIT compilation
of the MSIL, while it does optimizations, it doesn't do runtime
optimizations. The normal JIT compile, on the other hand, can do
Processor-Specific Optimizations, Optimizing away levels of indirections,
Optimizations across assemblies and Aggressive inline functions. So under
certain circumstances you not only DON'T gain with ngen, you can actually
lose. Recommendations include actually testing under various types of load
to see which one is faster.

2. JIT compilation occurs on a method by method basis and is not done until
a method is first called (and any process can do that, so if multiple copies
of the program are running the second+ invocations do not incur any
penalty). That means the startup penalty may not be as great as one might
perceive. If you just load a form, you don't suffer the pain for any of the
events on the form until they actually fire. If someone else is running the
same program - no penalty at all if they've already called them!!

3. JIT compiling is actually a very tiny part of program execution. Just
loading the program from disk takes far longer. In many cases you will not
be able to perceive the difference. Example: one test showed 2.1 seconds for
ngen and 2.5 seconds for JIT to load a large program. .4 seconds in a range
of 2.5 seconds may not be noticeable by anyone.

My personal feeling is that Microsoft has implemented JIT compilation
incorrectly or incompletely. I think that JIT compilation on a given machine
should take place once and only once - forever..... unless the code, or
other things like the processor or the OS Service Pack change. This could be
accomplished by putting compiled code into a native image cache and marking
them as temporary and invalidating individual ones or the entire cache when
necessary. Few of the runtime optimizations would be compromised by doing
that as few of them have to be dynamic on a given machine. And perhaps you
could be spared a problem by setting a bit that forces it to always JIT.
Dynamic caching would allow precompiled code to survive machine shutdowns or
complete process terminations. It would also eliminate the need to use
ngen!

One result of not doing this can be very horrible performance for ASP.NET
applications every time a machine reboots, or every time one does an
"iisreset". Imagine all the applications that are simultaneously being
accessed on a busy multi-homed computer all having to JIT again and
especially with user controls which aren't even compiled at all yet. It can
make for a real performance bog down for a short while, something that may
be intolerable in certain circumstances. ASP.NET apps cannot be ngen'd
because they are shared AppDomains, so there isn't even a way to cure this
with ngen.


Wray Smallwood


"Guy Cox" <guycox@cox.nouspam.net> wrote in message
news:03a801c33aa9$b3b232f0$a60
1280a@phx.gbl...
> I keep running across a question in the practice exams is
> something like -- Users complain about the slow start up
> performance..
>
> On of the answers is to NGEN the assembly and deploy a
> native image. NGEN places the native assembly in the
> application cache - I just ran a test building setup with
> the same assembly before and after the NGEN. The sizes
> are the same - I doubt that the native and the MSIL code
> sizes would be the same...
>
> I'm taking the exam on Friday -- So if the question comes
> up should I answer it the way the practice exams count as
> correct or do the right thing..



Sponsored Links





Free Braindumps | MCSE braindumps software forum

Copyright 2003 - 2008 examnotes.net