Until now Mono’s code generation engine was based on a tree Intermediate Representation (IR) of the code. Version 2.2 has a new engine based on a linear IR, which brings significant speed and code size improvements.
The previous tree-based IR made it “difficult to improve code generation and extend the JIT engine in meaningful ways”, according to Miguel de Icaza. The new linear IR helps to “improve the visibility of register usage to the register allocator, so it can make better choices when producing code”.
Work on the linear IR started in late 2005. The work progressed but the Mono team did not want to include the new engine into 2.0 due to the significant amount of work involved. Now, that the 2.2 version has been released, Mono has the new engine.
The most important effect of the change is shown by the benchmark results:
Speed: The engine will mostly benefit computationally intensive code, usually between 10% and 30% performance increase, with some cases going up as high as being 50% faster.
Code size: the new engine generates slimmer code, typically 12% to 20% smaller code generated.
Those interested in the details regarding the new engine can get them from Mono’s web site. The Release Notes for 2.2 mention the following main improvements: increased performance, support for full ahead of time compilation, support for monitoring through PerformanceCounters, attaching code live, SIMD support and others.