Where the native code store for second time execution

G

Guest

Where the native code store for second time execution. When it will clear or
how long it will be there ?
 
G

Guest

Hi Umeshnath,

Please consider the following code...

public static void main()
{
Console.writeline("First call to the writeline method");
Console.writeline("Second call to the writeline method");
}

When the call to writeline is made, the JITCompiler has to convert the
intermediate language (IL) into native code. The IL is stored in the
assembly's metadata that the code is contained in. The JITCompiler stores the
native code in a section of memory that has been dynamically allocated and
then redirects the call to Console.writeline to the newly created native
code.

When the second call to Console.writeline is made, the native code has
already been compiled and can be executed without the 'compile to native'
step.

This means that there is a slight performance hit the first time the call to
writeline is made but not the second time.

Since the JITCompiler stores the code in dynamically allocated memory, it is
thrown away when the application terminates. If you stop the application and
then re-run it, the code for writeline will have to be JITCompiled again as
explained previously.

Hope this helps,

wibberlet (development blog at http://wibberlet.blogspot.com)





=================================================
 
G

Guest

Hi,
My query is slight different you think about to run a dot exe and close it,
then again you try to run it the same exe. You can see, in the second the exe
is executed faster than the first time. When exe is running the JIT compiles
and generate CPU specific native code and store it into the process specific
memory and run it. When close normally it will unload from the memory then
how second time it will be faster.

If it stores some where ,where exactly , when it removes ……..
 

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