Linked by Thom Holwerda on Fri 17th Jul 2009 10:45 UTC
Thread beginning with comment 373902
To view parent comment, click here.
To read all comments associated with this story, please click here.
To view parent comment, click here.
To read all comments associated with this story, please click here.
Any particular reason Mono doesn't always do pre-JITting?
Not sure. The pre-JITted native image is installed next to the CIL executable, so I assume it can't normally be done by a regular user - it'd have to be done at install time. You certainly can't run ngen on Microsoft's .NET implementation without admin privileges.
Pre-JITing requires the generated code to be a shared library. This is required so that the same code for say System.XML can be used in two different applications that might end up loading the pre-generated code at different addresses.
The code produced by shared libraries is a bit slower than static code. Invocations need to go through at dispatch table (In Mono and ELF systems it is called the PLT table) and access to global variables also has to go through extra steps and usually ties up a register to keep track of things.
So all of these things mean that you end up with code that might not be as efficient as the static code.
We essentially let the sysadmin make the call





Member since:
2007-09-08
Neither Mono nor Microsoft's .NET runtime do this. They both behave the same as Java's client VM - JIT the code once, the first time it's called, and try to balance runtime speed with JIT time.
Java's server VM does as you describe. It's equivalent to using profile-guided optimization in C/C++ compilers, except it's automatic. It also turns on a lot of compiler optimizations that are too expensive to perform in an interactive application.
.NET doesn't have this. It does have an offline compiler, which pre-JITs an entire assembly with all the compiler optimizations turned on. The JIT doesn't do anything at all at runtime.