[Mono-list] Performance issue

A Rafael D Teixeira rafaelteixeirabr@hotmail.com
Tue, 04 Sep 2001 13:06:33 -0300

>From: Lloyd Dupont <lloyd@galador.net>
>i recently write a graphical C# application which is also computing
>intensive. (in fact memory move) i had the bad surprise to see that it > 
>was a bit slower  than the same demo in pure C.
>this is very annoying. Does someone know if there is performance issue 
>considering C# ?
>i believe it was same performance than natively compiled code ?
>Has anybody experience or knowledge on his topic ?

C# is compiled to IL which is stack-based, and then JITted to native 
assembler. The JITter doesnīt have enough time to optimize the code a lot, 
so itīs kind of natural thing to expect that C# and VB.NET, and every other 
language compiling managed code will perform slower than C/C++ compiled to 
native instructions.

Thatīs why Microsoft kept VC++ in the Visual Studio.NET package and why 
PInvoke (Plataform Invoke, a way to call native services) is such a critical 
addition to the runtime (see this list archives to see the many threads 
about this matter)

That said, the CLR(and therefore C#) isnīt so bad when we talk about doing 
object manipulation, that is what it was designed for, with behind the 
scenes garbage collection, safety checks, and security checks.

Have you tried to use Unsafe code? That way you can manipulate pointers and 
perhaps gain some speed, at the cost of having all the usual pesky problems 
with pointers.

Rafael Teixeira
Brazilian Developer

Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp