Linked by Thom Holwerda on Fri 17th Jul 2009 10:45 UTC
Mono Project Mono from SVN is now able to use LLVM as a backend for code generation in addition to Mono's built-in JIT compiler. "This allows Mono to benefit from all of the compiler optimizations done in LLVM. For example the SciMark score goes from 482 to 610. This extra performance comes at a cost: it consumes more time and more memory to JIT compile using LLVM than using Mono's built-in JIT, so it is not a solution for everyone. Long running desktop applications like Banshee and Gnome-Do want to keep memory usage low and also would most likely not benefit from better code generation. Our own tests show that ASP.NET applications do not seem to benefit very much (but web apps are inherently IO-bound). But computationally intensive applications will definitely benefit from this. Financial and scientific users will surely appreciate this performance boost."
Thread beginning with comment 373902
To view parent comment, click here.
To read all comments associated with this story, please click here.
RE[2]: Slow JIT
by ba1l on Fri 17th Jul 2009 15:28 UTC in reply to "RE: Slow JIT"
ba1l
Member since:
2007-09-08

There are several types of optimization algorithms and during the execution of you program the VM (JVM, CLR, and so on) might reach the conclusion that a certain piece of code would benefit from a different type of optimizations and so recompiles the code again.


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.

Reply Parent Bookmark Score: 3

RE[3]: Slow JIT
by vivainio on Fri 17th Jul 2009 18:13 in reply to "RE[2]: Slow JIT"
vivainio Member since:
2008-12-26

.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.


Any particular reason Mono doesn't always do pre-JITting?

Reply Parent Bookmark Score: 2

RE[4]: Slow JIT
by ba1l on Sat 18th Jul 2009 02:22 in reply to "RE[3]: Slow JIT"
ba1l Member since:
2007-09-08

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.

Reply Parent Bookmark Score: 2

RE[4]: Slow JIT
by miguel on Sun 19th Jul 2009 03:33 in reply to "RE[3]: Slow JIT"
miguel Member since:
2005-07-27

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

Reply Parent Bookmark Score: 1