How much the speed difference between c++ and c#?

Started by
7 comments, last by Spoonbender 19 years, 7 months ago
Is it necessary to use c++ make a game for windows? Is the speed of game made with c# unacceptble? Who have the experience about this?Any reply is appreciated!
Advertisement
Hi!

The speed difference is less than 10%. However, many games aren't cpu but gpu bound that's why there is almost no difference.

While I still recommend C++ for AAA titles, I think that C# is a better choice for low and medium budget games. I'm currently working on a game written in C# - so take a look at my homepage ;-)
Have fun BunnzPunch'n'Crunch
No it's not necessary to write the game in c++, just go with what you like c# is ok and in terms of speed you probably won't notice a difference on most modern computers. But speed is also influenced on how you write your code, so you have to keep that in mind.
Wait and C# [wink].
AAA titles will be written in .NET languages two years from now.
Why? The next generation of Windows will be build on top of .NET technology so I expect the performance difference to be negligible by then.

You can also take for granted that you won't see a noticable difference now either. Instead of working on programming principles many beginners struggle with the odds of C++ because "it's faster".
To me the fastest tool is the one that gets the job done and quick.
C# (and VB.NET), Java, Python and the like are well suited for that.

If you really need that extra bit of performance you can still write some parts in C++ and interface with them.

In short: C# is fine. C++ is too. Choose whatever you are most productive with.
No, AAA games won't be written in C# in a short future.
Most games are developped on both PC/Consoles.

As console programming require lowlevel memory management, VM languages won't be welcome till some hardware revolution.

Howether, i agree that homebrew games can be programmed with C# but i don't see a lot of advantages.
The only advantage in game programming is the framework that could be used for a world editor.

It seems that lots of people are lost when they need to select their development tools.
I think that dedicating some time to try several tech and then making a final decision is worth it.

The C#/C++ choice looks similar to me as the OpenGL/DirectX choice.
Just use the tech you think you'll have better/faster results.
The Sands of Time Are Running Low
Deckards has it right. Unless C# moves onto the consoles it will have a hard time getting adopted at the big production houses. On our last publishing deal the publisher wanted us to make our code "potentially portable" to consoles in case they wanted to migrate it there.
We will continue to see quite a significant difference between C# and C++ I think for a while yet.

Perhaps once vendors put some serious work into CPU-specific optimising compilers for .NET, it will get decent performance. High-performance apps (like scientific/engineering computing) will not use it until then.

High performance computing does not use Microsoft or GCC compilers because they don't produce good enough code.

BUT the performance difference is not significant if your application spends most of its time

- Waiting for the GPU
- Waiting for something else
- In unmanaged code (for instance library calls)

So there is still compelling reasons to use C# if your company strategy allows you to do so.

Personally I don't believe it's much more difficult to develop games in C++. Memory management issues are a lot less significant than people think. If the tools are good, it should be just as quick to develop. I don't have any decent C++ tools, so for me it is generally slightly slower.

Yet it still boils down to the fact that most of my time programming is spent working on algorithms - designing them, implementing them, and debugging them. In C++ I spend hardly any time writing MM code or debugging MM problems.

Mark
Quote:Original post by Deckards
No, AAA games won't be written in C# in a short future.
Most games are developped on both PC/Consoles.

As console programming require lowlevel memory management, VM languages won't be welcome till some hardware revolution.


But mobile programming doesn't? o_O

Seriously. Anyone want to propose a reason that garbage collection *can't be done* on a console? That sounds ridiculous to me.
How about because console games can't usually afford even a performance hit of 0.5%. Because garbage collection is unpredictable, even if it can be done efficiently.
And with consoles, you'll want to keep the cpu busy all the time, and if it suddenly decides to do some garbage cleanup when you expected it to do nothing, you're in trouble.

Or because consoles don't have virtual memory. They have a few mb of ram, and the developers would probably want to know *exactly* how much memory is free, and when it is freed.

I'm not a console developer, so just guessing. But it makes sense to me. :)

Anyway, use any language you like. They're similar enough that it's easy to switch over if you decide to.

At the moment, just about all game development is done with C++, and that will take time to change. (Until a few years ago, several high-profile games still used C)

But that's not to say C# isn't possible, or "too slow". Wait with those decisions until you actually need to write Doom 4 or similar. For normal mortals working on pc games, both languages are fast enough.

This topic is closed to new replies.

Advertisement