Jump to content
  • Advertisement
Sign in to follow this  
_Danneman_

Speed and C#

This topic is 4827 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

Advertisement
The consensus is that C++ MIGHT be a BIT faster (1 to 2 percent) on certain occasions. The second consensus is that it REALLY doesn't matter.

Share this post


Link to post
Share on other sites
Quote:
Original post by xMcBaiNx
The consensus is that C++ MIGHT be a BIT faster (1 to 2 percent) on certain occasions. The second consensus is that it REALLY doesn't matter.


I've seen people say the, and I too say the same thing, but noone ever showed real "charts" or proof of how this is true.

I recently googled for some speed comparision and found a site that said they compared C++, C, Java and C# speed-wise. In the end results, they claimed that C# ran even slower than Java. However, as I have experience with all aforementioned languages I declared those results bullshit.

C# definetly runs faster than Java, much faster, however, I have never seen any real proof of how much slower C# is compared to C++. And just because you read it on the internets, doesn't mean it's true. ;)

I'm a pro-C# programmer, and I use C# for games, but some real proof would be nice tho.

Toolmaker

Share this post


Link to post
Share on other sites
What actually happens with the just-in-time-compilation that the c#-code goes trough?

Is the entire code compiled to machinecode only once at the beginning - as compared to java which lets the virtual machine compile the code over and over again at runtime?

Wouldnt that mean that the only overhead would really be the initial loadingtime (as the code is compiled), but subsequently the speed would be virtually the same as C++ (not considering other factors)?

Share this post


Link to post
Share on other sites
Quote:
Original post by _Danneman_
as compared to java which lets the virtual machine compile the code over and over again at runtime?


Java code is compiled [once] into bytecode (the .class files), which is then executed by the VM.

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
check out: http://shootout.alioth.debian.org/benchmark.php?test=all&lang=csharp&lang2=gpp&sort=fullcpu

Share this post


Link to post
Share on other sites
Programming Language Shootout compares language implementations with Debian packages for them.

Commercial stuff is missing this way, but you can download the testsuit and run it on the implementations you want to compare.

Even the opensource C# for Linux (Mono) is faster than Java, so it will certainly be faster on windows.

Mono vs Intel C++ Graph

Share this post


Link to post
Share on other sites
You cant really compare languages like that, it depends on how you code. You could make a game in VB which are 1000% faster than the equivaliant C++ game, but that would be because the C++ code is worse than the VB code.

The JIT(Just-In-Time) compilation thing means that when you build your executable it wont get (completly) compiled. So the first time it reach some code it will be compiled, this means that your first run might be a little slow, but after that it is compiled (also next time you start your program).

Even though you cant directly compare C++ and C# speed, normally if two equally good programs are coded in both languages the C++ one tend to be a bit (couple of %s) faster.

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
In terms of game performance, even a discrepency of 10% is unlikely to take your game from playable to unplayable. Whether it's 110fps to 100fps or 33fps to 30fps, the difference is unnoticable to the end user. As a game developer you should be concerned with what gets the job done best- not what gets the job done eventually with a few more measly frames per second.

Quote:

C# definetly runs faster than Java, much faster

Sorry, but not even C++ runs much faster than Java on today's computers. If you want to talk about "problems" with Java, look at the memory consumption. Of course, that's a discussion for another day...

Share this post


Link to post
Share on other sites
Quote:
Original post by Anonymous Poster
Quote:

C# definetly runs faster than Java, much faster

Sorry, but not even C++ runs much faster than Java on today's computers. If you want to talk about "problems" with Java, look at the memory consumption. Of course, that's a discussion for another day...


Are you sure you know what you are talking about? C++ gets compiled to a binary format while Java, as far as I know, is saved as byte-code.

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.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!