[Mono-list] Chrome

Jonathan Pryor jonpryor at vt.edu
Wed Jan 25 20:23:08 EST 2006


On Wed, 2006-01-25 at 16:25 +0100, Malte Dreschert wrote:
> The second question I have is more general. Concerning the whole .net / 
> Mono thing, is it important for the overall performance of an 
> application, which language it is written in? It seems that is only a 
> question of personal taste.

Maybe. :-)

In theory, it shouldn't matter, as conceptually all languages can
compile down to the same IL.

In practice, differences can matter.  I've heard that the same
conceptual program/algorithm, for VB.NET and C#, the compilers will
generate different IL.  IIRC this was because the C# compiler (at the
time) was spending more time on optimization, but that need not always
be the case.

Furthermore, some languages make certain programming constructs easier
to represent than others, which may allow the compiler to perform
more/different optimizations.

For example, a "simple" compiler would compile this C# fragment:

	s = "a" + "b";

into

	s = new StringBuilder().Append ("a").Append("b").ToString();

A better compiler would generate:

	s = string.Concat ("a", "b");

A good compiler would generate:

	s = "ab";

Obviously, choosing between these choices will vary by compiler, and how
much time/effort the compiler writers are willing to spend.  (Then
expand this example to interactions between strings and other object
types, thus complicating the performance advantages of each
implementation.)

IL is not a language equalizer.  It provides for better interaction
between languages, but it doesn't remove the compiler from the equation.
IL isn't substantially different from assembly language, as far as the
need for a good compiler is concerned.  (Especially when the language
provides low-level functionality, such as C++/CLI.)

 - Jon




More information about the Mono-list mailing list