r/learnjava • • Nov 03 '20

Why is c faster than java?

If I were to make the same thing in java would it now be as fast ?

58 Upvotes

26 comments sorted by

View all comments

7

u/[deleted] Nov 03 '20

I'm not a Java user, I despise oop gibberish with all my heart that being said the whole x is faster is a bs argument that fits a niche of developers that need to deliver near-metal performance (which btw doesnt even happen in best optimized videogames, best case scenario we speaking about specific algorithms) and developers who have no idea what are they talking about and most importantly wouldn't even know how to test bottlenecks.

There's people shoving complex Java applications since decades on computers that had a tiny amount of power compared even to a small cheap smarphone don't worry about this performance non sense. And in all that time compilation of Java made enormous steps forwards which alone make it faster. Just so you know btw, same algorithms running on the jvm and implemented in X have very low % differences.

Also don't listen to this whole "C is closer to the computer" thing, this ain't 1993 and the code a compiler written in the last 10 years gives you back is insanely different than what the programmer thought it would map and I'm not even accounting for the billions of optimizations at the isa and microcode level that basically make what you wrote have nothing to do on the machine level with what the code actually does.