[Mono-dev] C# to x86 assembly code?

Jonathan Pryor jonpryor at vt.edu
Mon Sep 18 20:30:54 EDT 2006

On Mon, 2006-09-18 at 14:27 -0500, Jonathan Gilbert wrote:
> At 08:44 PM 18/09/2006 +0200, Marcos  wrote:
> >Hi Auge,
> >
> >You can currently use Mono AOT compilation (Ahead-Of-Time; "mono
> >--aot" I think) in order to get a precompiled binary, It'll cause your
> >application to run faster, between some other things.
> More specifically, it will cause the application to start up faster. The
> actual run speed in practice shouldn't be noticeably different from
> on-the-fly JITted code. It's the same engine, after all, emitting the code.
> :-)

More specifically, it *might* speed things up, and it might not.

There was a .NET developer blog (last year?) that did some timing
analysis for .NET, and found that for *cold* starts, the JIT was
_faster_ than NGEN-generated code (the equivalent of `mono --aot`).
Why?  Because IL is smaller than x86 assembly, so less data needed to be
read from disk, and the JIT was fast enough that it didn't slow things
down in that case.

On the flip side, for *warm* starts (i.e. the NGEN code was already in
the OS disk cache), NGEN code was faster than JIT code (as the OS didn't
have to hit the disk).

Then there are other issues (the JIT can do direct method calls, while
NGEN/AOT code needs to go through an indirection for each method
invocation so that the assembly loader can fixup method addresses, just
like with normal Win32 DLLs and ELF shared libraries).

So the only way to know for sure which is faster is to test.

 - Jon

More information about the Mono-devel-list mailing list