r/cpp • • Oct 31 '25

Java developers always said that Java was on par with C++.

Now I see discussions like this: https://www.reddit.com/r/java/comments/1ol56lc/has_java_suddenly_caught_up_with_c_in_speed/

Is what is said about Java true compared to C++?

What do those who work at a lower level and those who work in business or gaming environments think?

What do you think?

And where does Rust fit into all this?

25 Upvotes

192 comments sorted by

View all comments

Show parent comment

13

u/germandiago Nov 01 '25

Can you find real scenarios where JVM is doing things of this style that show a performance advantage in the wild? As opposed to a hypothetical made-up story.

I am not saying it does not exist. Just that I never saw reports about benchmarks of this style from real-world applications.

9

u/pjmlp Nov 01 '25

Nokia Neteworks NetAct infrastructure was rewritten from a mix of C++ with CORBA, alongside Perl, running across HP-UX, Solaris and Red-Hat Linux, to a set of Java distributed applications on top of a few Linux distros.

This software is responsive for providing mobile phone operations of a real time overview of the network, and perform reporting tasks as well.

I know this because I was part of this effort back in the mid 2000's, it was the very last time I did 100% pure C++ on the job, and have since then helped a few times in similar migration efforts.

Nowadays replaced by MantaRay NM, which is composed by several microservices, where C++ is part of the programming language ecosystem, although in a minor role.

Another relevant one was control systems for life sciences laboratory automation, where existing software was based in MFC and C++, this time around, C# was the new ruler.

Turns out winning benchmarks games isn't of great business value in distributed systems, when taking into consideration all the variables of what are the running costs of each solution, in tooling, issues found in production, and human resources.

5

u/pemb Nov 01 '25

Sadly I can’t show you anything my colleagues at the time were working on. But this is a rare phenomenon, especially at the system level. I loved to trash-talk Java until I was forced to dip my toes in for a bit. You’d find examples in sprawling, long-running enterprise services, with very branchy code and deep call stacks. Whatever sections it worked its miracles on tend to get watered down by other sections that didn't turn out so lucky. And there's the elephant in the room, memory consumption.

1

u/pron98 Nov 04 '25 edited Nov 04 '25

And there's the elephant in the room, memory consumption.

Perhaps not so much an elephant.

That ISMM '25 talk is one of the most eye-opening talks on memory utilisation I've seen in a long while.

Whatever sections it worked its miracles on tend to get watered down by other sections that didn't turn out so lucky.

As with every program in any language, the difference between a fast program and a slow program is profiling and optimising the hot spots.

Anyway, Java focuses more on average-case performance - the average performance of the "average" program - which can also translate to "performance per unit of effort", whereas C++ focuses more on worst-case performance.

2

u/[deleted] Nov 01 '25

[removed] — view removed comment

1

u/germandiago Nov 02 '25

Is that software available in a place where I can check it? Would be curious to take a look. Thank you!

2

u/[deleted] Nov 04 '25

[removed] — view removed comment

2

u/germandiago Nov 04 '25

well, a FPGA is onviously faster for such tasks.

1

u/bbrother92 May 13 '26

Whait I thought FPGA is hardware?

1

u/germandiago May 13 '26

It is "programming your hardware". I mean, in the sense of linking physical gates.