Compile at installation / cache

B

babylon

I read an article http://www.developerfusion.com/show/1678/3/
that the CLR will cache the native code generated by the JIT for future use
what does it means?
does it mean
- there is a place to store the exe so that even i reboot the system, the
native code are still cached?
- or it mean it will be cached @ memory; further execution of the same code
will still be in native code?

Also; what does it means for compile @ installation???does it mean GAC?or?
how to enable this feature?

thank you
 
N

Nick Wienholt

This article looks like it's talking about a beta version of .NET, and is
not correct WRT the .NET Framework 1.0 or 1.1. You can force native code
generation using NGEN, which stores a native image on disk in the assembly
folder under the main Windows folder (C:\Windows\assembly in most cases).
The MSDN library docs on NGEN are a good start, and I've also done a NGEN
article archived at [1].

Nick Wienholt, MVP
Maximizing .NET Performance
http://www.apress.com/book/bookDisplay.html?bID=217
Sydney Deep .NET User Group www.sdnug.org

[1] http://www.dotnetperformance.com/presentation/NGEN.doc
 
B

babylon

i successfully used Ngen to generate an native image...
but how do I start it?
I tried to goto the directory and start the exe, it said it is not a valid
win32 program.....

and...does it mean that the program already compiled into machine code (but
still managed by the CLR?)???
thx!!!

Nick Wienholt said:
This article looks like it's talking about a beta version of .NET, and is
not correct WRT the .NET Framework 1.0 or 1.1. You can force native code
generation using NGEN, which stores a native image on disk in the assembly
folder under the main Windows folder (C:\Windows\assembly in most cases).
The MSDN library docs on NGEN are a good start, and I've also done a NGEN
article archived at [1].

Nick Wienholt, MVP
Maximizing .NET Performance
http://www.apress.com/book/bookDisplay.html?bID=217
Sydney Deep .NET User Group www.sdnug.org

[1] http://www.dotnetperformance.com/presentation/NGEN.doc

babylon said:
I read an article http://www.developerfusion.com/show/1678/3/
that the CLR will cache the native code generated by the JIT for future use
what does it means?
does it mean
- there is a place to store the exe so that even i reboot the system, the
native code are still cached?
- or it mean it will be cached @ memory; further execution of the same code
will still be in native code?

Also; what does it means for compile @ installation???does it mean GAC?or?
how to enable this feature?

thank you
 
N

Nick Wienholt

I tried to goto the directory and start the exe, it said it is not a valid
win32 program.....

You start the program the normal way (by double-clicking on the original
EXE), and the CLR will automatically use the NGENed image if it is valid and
available - you still need the managed exe for metadata.
and...does it mean that the program already compiled into machine code (but
still managed by the CLR?)???

Yep.

Nick Wienholt, MVP
Maximizing .NET Performance
http://www.apress.com/book/bookDisplay.html?bID=217
Sydney Deep .NET User Group www.sdnug.org
 
B

babylon

Thank you
I tried to use ngen to 'install' the native image and run the program in
debug mode
I found that in the "modules" windows, the path of the "installed" image is
not pointing the windows\assembly, but the default output directory...

well, i've checked the JIt object in perfmon, the native image DID prevent
the JIT complier from compiling the IL.

so..can you tell me if it is a normal behaviour for the debugger or not?

thx!
 
B

babylon

it's really helpful!
thank you very much!

Nick Wienholt said:
The presence of the debugger won't step a NGEN image being loaded - you need
to ensure you have native (unmanaged) debugging enabled, and your assembly
version fixed to a specific value (not 1.0.*.*), as an assembly version of
1.0.*.* will cause the exe built by hitting F5 to have a different version
number to the NGEN image, which will mean it won't be loaded.

Screenshot of VS2003 blow to prove it can be done :).

Nick
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top