Is the output of JIT cached ?

  • Thread starter Thread starter chak
  • Start date Start date
C

chak

These may be a very basic question.

1) Is IL compiled to native code every time a application is invoked ?

2) If a process has multiple appdomains (i think each instance of an
application maps to an appdomain), if one application is closed will the
appdomain close ? If the same application is then re-invoked will it use the
JIT-ted code generated last time , or will it again JIT ?

Regards,

Chak.
 
chak said:
These may be a very basic question.

1) Is IL compiled to native code every time a application is invoked ?

JIT = Just In Time so only those bits actaully called will be compiled.
2) If a process has multiple appdomains (i think each instance of an
application maps to an appdomain), if one application is closed will the
appdomain close ? If the same application is then re-invoked will it use
the
JIT-ted code generated last time , or will it again JIT ?

I don't know what it does but there is no need for it to generate code twice
for the same IL just because it is loaded into two different appdomains.
 
These may be a very basic question.

1) Is IL compiled to native code every time a application is invoked ?

2) If a process has multiple appdomains (i think each instance of an
application maps to an appdomain), if one application is closed will
the appdomain close ? If the same application is then re-invoked will
it use the JIT-ted code generated last time , or will it again JIT ?
Have a read of this article,
http://msdn.microsoft.com/msdnmag/issues/05/04/NGen/default.aspx
 
Thanks. The article referred to by you states :

"As you know, the just-in-time (JIT) compiler is used for compiling the
Microsoft intermediate language (MSIL) code in a .NET assembly into native
code for the local machine immediately before the code is executed. This is
temporary code; it is created and stored in the running processes's memory
space, which is reclaimed by the OS when the process dies. Thus, it will be
regenerated each time a new process needs it."

So i think it answers my question to the effect that even if two different
people accessed the same application seperately, from 2 different PC's, it
would create 2 instances of that application in 2 different application
domains of the respective local machines , by JIT compiling it twice (one
for each instance). Is my understanding right ?

Thanks.
 
You are answering a different question to the one that you originaly posed:

Yes you are right that if 2 people access an app from 2 machines then it
will get JIT'd twice i.e. it's not like python - where it compiles to a .pyc
file in the same directory [actually that's not an exact analogy because
python is doing the equivalent of C# -> MSIL rather than MSIL -> obj but
hopefully you get the point]

What you originaly asked was whether it would compile twice if you loaded
the same assembly into 2 app domains in the same process (necessarily on the
same machine) and there is no reason for it to do so.


chak said:
Thanks. The article referred to by you states :

"As you know, the just-in-time (JIT) compiler is used for compiling the
Microsoft intermediate language (MSIL) code in a .NET assembly into native
code for the local machine immediately before the code is executed. This
is temporary code; it is created and stored in the running processes's
memory space, which is reclaimed by the OS when the process dies. Thus, it
will be regenerated each time a new process needs it."

So i think it answers my question to the effect that even if two different
people accessed the same application seperately, from 2 different PC's, it
would create 2 instances of that application in 2 different application
domains of the respective local machines , by JIT compiling it twice (one
for each instance). Is my understanding right ?

Thanks.
 
Back
Top