Advertisement Jump to content
Sign in to follow this  
azherdev

C# vs C++ as a choice for development

This topic is 4620 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Ok, I have read many articles on one versus the other. But, they all seem to be theoretical. I mean, C# _is_ slower than C++ in many cases. I know that Managed DX is about 90% the speed of unmanaged. But, has anyone implemented games in both and has real-world numbers as far as fps or ms? I am currently making my engine in C# and fine tuning it. For me to convert it to C++ at this time will take me a month or two. So I am wondering if it is worth it to switch over to C++ now and move on or can I continue with .NET? I don't like the required .net framework or the fact that it takes way longer to start than a C++ app or the fact that in task manager it shows 25 megs for my hello world .net app. But, is C++ speed advantage that great over C# to lose the development speed? I can live with a 10 - 15% drop. So, in a nutshell, has anyone done C++ game, and then a similar or a port of it to C# and noticed speed differences? Thanks

Share this post


Link to post
Share on other sites
Advertisement
With regards to Managed vs Unmanaged code:

Certainly no single human with less than a decade of experience can even begin to hope to create applications in one language where speed difference in executed code are the cause of slow downs and not inefficient algorithim implementation and design.

Basically, it is unlikely, the chances highly remote that you'd ever run into the case where the "speed" differences would actually matter. The probability of encountering a scenario where languages create speed bottlenecks decreases with time. Processor and operating complexity further diminish this alleged spped gap.

[Edited by - Daerax on May 12, 2006 6:32:21 AM]

Share this post


Link to post
Share on other sites
Remember, C# features JIT (just-in-time) compiling, or the ability to dynamically compile the application at runtime, allowing for theoretically better speed and performance than a C++ application.

Google link

Share this post


Link to post
Share on other sites
I always like thoses threads!!

What is better C++ or C? C++ or VB? C++ or C#?

Quote:
I don't like the required .net framework or the fact that it takes way longer to start than a C++ app

This can be fix at setup. You can "compile" the code to native code at setup. Someone know how? I remember reading this somewhere in MSDN but i cant find the article, some can point it to me plz?
Quote:
the fact that in task manager it shows 25 megs for my hello world .net app

This is simply due to the .NET framework being loaded. When managed code will be the norm, you won't see any difference.
Quote:
But, is C++ speed advantage that great over C# to lose the development speed? I can live with a 10 - 15% drop.

You just answered your question yourself! So why ask the question!?

Share this post


Link to post
Share on other sites
I understand that the efficiency of the code/algorythm does matter. One developer can write an app faster in C# than another in C++ because of better optimizations.

I am just wondering if C# is a safe bet. I mean, VB6 was NEVER a good enough language to develop a respectable game. So that is what I am wondering, is C#/VB.NET same as VB6 when it comes to real-world development of games. I use .net framework for business apps and I will NEVER make an application with C++.

From what I see, MS is determined to push .net platform so as a language, it is kind of future-proof. But for real time apps like a 3d game? By the way, I am not creating any ground-breaking engine here. But nor do I want to perform at 50% of DX power simply because I have chosen to implement my engine in C#.

Thats why I am wondering if someone out there actually made a game in both to compare. Having made classes in C++ and in C#, seeing their memory and speed comparisons, etc.

Oh, and I know that there is a hit of about 10% for MDX, but. In a game, sometimes you create/destroy hundreds of classes or structures or variables every frame, 60+ times per second. That is what I am wondering about. How does C# hold up to C++ when such great amount of objects is created, used, destroyed, accessed, etc.

Oh, and what about throwing in Visual C++ managed? Power of both? Anyone? Anyone? Bueler? Bueler? :)

Share this post


Link to post
Share on other sites
Quote:
Original post by LowRad
This can be fix at setup. You can "compile" the code to native code at setup. Someone know how? I remember reading this somewhere in MSDN but i cant find the article, some can point it to me plz?


Do you mean the NGEN utility?

Share this post


Link to post
Share on other sites
LowRad, I know there are tons of these threads. I am not asking which one is better though. I would like to know if someone has used both for game development and has some real-world numbers to throw out there. I've developed in C/C++, VB6, .NET, SQL, etc. I understand that each language has its place, its weaknesses, its strengths.

So please, I do NOT want this to be a thread of C++ is better or C# is better.

Share this post


Link to post
Share on other sites
Sorry if i sounded rude (that was not my intention),

I thought that the question was not really necessary after you said:
Quote:
But, is C++ speed advantage that great over C# to lose the development speed? I can live with a 10 - 15% drop.


I mean, do you really want to rewrite/translate everything to gain 10% in speed and loose ~25% in coding time? No.

Regards,
Jonathan

Share this post


Link to post
Share on other sites
Quote:
Original post by Rockoon1
Quote:
Original post by LowRad
This can be fix at setup. You can "compile" the code to native code at setup. Someone know how? I remember reading this somewhere in MSDN but i cant find the article, some can point it to me plz?


Do you mean the NGEN utility?


Yes thanks, i was looking for this to get rid of the compiling JIT, because like azherdev said, .NET suffer from JIT every first time you call something, it take ages!

Share this post


Link to post
Share on other sites
LowRad, no problem.

I wanted to know what experience people had to verify that it actually is 10% to 15%. Sometimes a small scale test shows 10% but once you scale it out, the drop becomes 40%. I read 10% in a lot of places, but that comes from MS itself. So is what I read a rehash of what MS said or what people really experienced?

Has anyone out there written a C# game based on MDX, not a 3rd party engine like TrueVision3D or Irrlich or anything else. Pure C# + MDX?

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!