does C# JIT save native executable data to binary after it's compiled?

  • Thread starter Thread starter Flip
  • Start date Start date
F

Flip

I just read on this site
(http://www.developer.com/net/csharp/article.php/10918_925741_3) that once
the C# compiler has compiled a portion of code, the native windows
executable piece is saved and that piece doesn't have to be compile ever
again. Is that true? I know in Java, code runs through the JIT, but it's
once per execution, if you stop and then restart the app, it's recompiled
again. But this leads me to believe that the more I run the app, the faster
it will get, is that true?
 
Flip said:
I just read on this site
(http://www.developer.com/net/csharp/article.php/10918_925741_3) that
once the C# compiler has compiled a portion of code, the native
windows executable piece is saved and that piece doesn't have to be
compile ever again. Is that true? I know in Java, code runs through
the JIT, but it's once per execution, if you stop and then restart
the app, it's recompiled again. But this leads me to believe that
the more I run the app, the faster it will get, is that true?

Here's what it says:

"The CLR actually compiles only the parts of the program that are being
used. This saves time. Additionally, after a portion of your IL file has
been given a true compile on a machine, it never needs to be compiled again,
because the final compiled portion of the program is saved and used the next
time that portion of the program is executed."

The JIT compiler compiles on a per method basis, so yes, only parts of the
program are JIT compiled. What actually happens is that the JITted code is
stored in memory so that when the *same* method is called at another time
the JITted code is used rather than the IL being JITted again. Nothing is
saved to disk.

Richard
 
Thank you Richard and Mattias for your responses.

I was under the initial impression the classes were compiled/JITted in
memory only, like java was, but then the part about "save and used the next
time that portion of the program is executed." was a bit ambiguous, IMHO
that is. So thank you for the clarification! :>
 
Back
Top