CLR Native JIT'ing

As I mentioned earlier, the NGEN tool in the CLR can be used to force the JIT to compile the IL to native format. You can also use it directly on an exe. For example
C:\\TEMP\\TestApp\\TestApp\\bin\\Release>ngen install TestApp.exe
Microsoft (R) CLR Native Image Generator - Version 2.0.50727.42
Copyright (C) Microsoft Corporation 1998-2002. All rights reserved.
Installing assembly C:\\TEMP\\TestApp\\TestApp\\bin\\Release\\TestApp.exe
Compiling 1 assembly:
    Compiling assembly C:\\TEMP\\TestApp\\TestApp\\bin\\Release\\TestApp.exe ...
TestApp, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
This results in the native image of the executable being generated in the Native assembly cache and the file can be inspected here. (You need to do this from a DOS prompt as this dir may not show up in explorer)
C:\\WINNT\\assembly\\NativeImages_v2.0.50727_32\\TestApp\\3d175dbade97d648b002a9881f995ca8>dir
Directory of C:\\WINNT\\assembly\\NativeImages_v2.0.50727_32\\TestApp\\3d175dbade97d648b002a9881f995ca8
04/06/2006  08:12 PM              .
04/06/2006  08:12 PM              ..
04/06/2006  08:12 PM            13,824 TestApp.ni.exe
               1 File(s)         13,824 bytes
               2 Dir(s)     774,688,768 bytes free
To verify that the native image is indeed being used at runtime, you can use the Assembly Binding Log Viewer (Fuslogvw.exe) tool. Fire it up, change the settings and log location, start your app and hit refresh. Something like this will show up verifying that the native image is being used.
The general guideline seems to be that one should test out the performance for both native/non native images. Just because its native doesnt really mean it will perform better but you may be able to reduce the memory footprint,and share memory pages across applications. Theres some detail around this in an April 2005 MSDN mag article here.


Comments:

Post a Comment:
  • HTML Syntax: NOT allowed
About

sameert

Search

Categories
Archives
« April 2014
SunMonTueWedThuFriSat
  
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
   
       
Today