Porting Applications from C++ to C#

Porting Applications from C++ to C#

Postby Cuchulainn » Sat Mar 08, 2008 5:17 pm

The claim that C# is [5,10] times is slower than C++ for an application is achievable but I don't think it is due to the compiler. All things being equal, C# performance is not too far from C++.

Now, the main question that I have is how you evolved your solution C++ --> C#

1. Shove the C++ code into .NET and take it from there

2. Use the C++ code as the requirements to write a new C# app

3. Take the UML design blueprints out of the fireproof cupboard and use them as requirements for a new C# app

4. other

Which approach did you take?

Somewhere along the line, the wrong datastructure, C# feature, function call etc. might have been chosen. I once had an app that went 1000 times faster after I threw out a recursive fucntio call; nested lists are also no nos.
User avatar
Posts: 669
Joined: Mon Dec 18, 2006 2:48 pm
Location: Amsterdam, the Netherlands

Postby zhouxing » Mon Jun 29, 2009 2:16 pm

I have been involved in a reasonably thorough analysis on this top before together with Microsoft technical person. The main reason to slow down C# is .NET's built-in security check. For example, if you use indexer (i.e. []) a lot, you will notice significant slower performance v.s. comparable C++ code.

This said, in reality, it is possible to write C# application whose overall performance is as good as C++ application (well save those pure numerical libraries). The key is to know what C# is good at and what are its weakness.
Posts: 4
Joined: Mon Jun 29, 2009 12:20 am

Return to C#

Who is online

Users browsing this forum: No registered users and 1 guest