Java vs C++ Performance

Cluster centers on debates about Java's runtime performance, speed, memory usage, startup time, and JIT optimizations compared to C/C++, Rust, and other native languages, challenging myths of Java's inherent slowness.

📉 Falling 0.4x Programming Languages
4,716
Comments
20
Years Active
5
Top Authors
#5159
Topic ID

Activity Over Time

2007
19
2008
45
2009
109
2010
182
2011
226
2012
206
2013
311
2014
255
2015
235
2016
326
2017
331
2018
238
2019
291
2020
364
2021
410
2022
367
2023
302
2024
204
2025
290
2026
5

Keywords

RAM e.g PHP play.html JIT JS OK Vert.x AOTC UI java jvm jit performance code memory fast faster gc slower

Sample Comments

markdestouches Jul 10, 2022 View on HN

What's the reasoning behind picking Java for a performance critical application over something like C or C++?

pkolaczk May 2, 2014 View on HN

Java is fast enough now to compete with C++ in some categories of software traditionally viewed as "high performance" e.g. web-servers or database systems. Applications running like "turtle on anything short of server-class hardware" is a result of bad-coding, not Java itself.

pron May 29, 2016 View on HN

> Java is slow and bloated compared to native.What do you mean by "native"? C/C++? Yes, given enough effort you can write C code that outperforms Java code, sometimes handily, especially in single threaded or low-contention cases. Yet we did write applications in C/C++ before we switched to Java, we had excellent reasons to make the switch, and there have been precious few companies making the switch back. That shows you that the microbenchmarks don't tell

sanxiyn Mar 15, 2019 View on HN

Most programs don't need C++ performance. Java is usually within factor of two and usually fast enough.

kpil Sep 25, 2017 View on HN

The only thing slow about java is the time to start the jvm.For everything else to be faster you need asm, c, c++, fortran, or rust.Loading an applet over a modem in 1998 doesn't count...

t0mas88 Nov 27, 2021 View on HN

For Java that's mostly a myth. Modern Java isn't measurably slower than C++ in many cases and faster in some.

Ziomislaw Mar 14, 2013 View on HN

jvm is really fast, it can usually compete with C++ code in terms of speed (if you ignore the startup time ;p )

lenkite Feb 22, 2022 View on HN

Java is fast but takes 5x-10x memory that a proper AOTC language app.

scottlamb May 24, 2020 View on HN

In particular areas (short timespans, specific tasks), Java can be thousands of times slower than C++/Rust. (Warmup/pre-JIT function evaluation, GC pauses, etc.) I have these kinds of performance rough spots, but I'm surprised to hear you do. It doesn't seem consistent with an argument for Java.

anextio Jun 28, 2025 View on HN

Java does not provide performance comparable to C/C++.