12/29/2005

Managed Code Speed vs UnManaged - and Rudolph.

Richard Grimes has a very recent piece here about comparisons between managed and unmanaged code.

He points out specifically: "The problem is that when most people think of .NET they think of other frameworks with a runtime, like Java or Visual Basic; or they may even think about interpreters. They do not think about applications, or what they do; they do not think about limiting factors like network or disk access; in short, they do not think.
.NET is not like those frameworks. It has been well though out and Microsoft has put a lot of effort in making it work well. In this article I will present some code that performs some computationally intensive operation and I will compile it as both managed C++ and unmanaged C++. Then I will measure how each of these libraries perform. As you will see, .NET is not automatically much slower than unmanaged code, indeed, in some cases it is much faster."
.

Grimes presents FFT (Fast Fourier Transform) sample code for Unmanaged, Managed C++, C++/CLI and C# Managed along with the respective high-performance timings. (I found it amusing looking at this because I wrote custom FFT code in Turbo Basic for my Ph.D. dissertation back in 1990!) . Grimes provides all the sample code in downloadable form.

The bottom line is that the results for C# code showed that there is little difference between C# and managed C++ in terms of performance. Indeed, the optimized C# library was actually slightly faster than the optimized managed C++ libraries.

You have to be very careful about the uninformed who are in a position of authority. They even populate the newsgroups. Who knows? One of them might even be your boss....


Only Rudolph the Red Nosed Reindeer really knows everything, and, wisely, he has nothing to say.