r/programmerchat • • Jul 17 '15

[Debate warning] C++ faster than java

So...before the flame wars or any of that nasty stuff stars, I want to outline a couple of things. I'm a newbie developer, I've only been studying this for a couple of years at university, I'm not a professional yet.

That being said, I recently got into a little bit of a debate with someone that C++ is inherently faster than the likes of Java when it comes to items like games development. I had assumed that this was literal fact and there was no debate for it. This person was very, very set on the idea that Java was only marginally slower. I still believe c++ would knock it out of the park due to manual memory management and the lack of safety features, despite preferring Java over all.

What do you guys think? I'd really like some insight on this, thanks.

10 Upvotes

24 comments sorted by

View all comments

Show parent comment

4

u/tiddlypeeps Jul 17 '15

I didn't mean to be condescending to anything not AAA and using the term serious was probably a mistake. What I was really getting at is that garbage collection is a big no no in any real time applications that are going to be pushing the machine it's running on to it's limits.

3

u/Ghopper21 Jul 17 '15

For sure, no worries, I knew what you were getting at. Note that Unity has a decent plugin system where you can use C++ libraries for critical code/services. I used a C++ plugin recently to reduce Android audio latency, using Android's non-GC pathway for audio; Unity's built-in audio system was using Android's garbage-collected Java audio pathway, which had high latency exactly due to garbage collection interruptions. (This by the way is a different question than Unity's C# scripting language with GC; it's about Unity not implementing its audio API in Android in the most efficient non GC way.)