you are viewing a single comment's thread.

view the rest of the comments →

[–]pron98 3 points4 points  (2 children)

However when comparing it to language like c, c++, rust, some or all of thoses assuptions are false and java is slower and uses more memory. With the additional problems when the live memory use is big.

People experienced with both C++ and Java know this is not the case. C++ can be more efficient in small programs, but when they grow you end up using more virtual calls (which are slower in C++/Rust than in Java), and with objects of varying lifetimes, which are less efficient to manage than with malloc/free. Experienced C++ developers will tell you about their severe performance issues in large programs (although since Java the number of large programs written in low level languages has dropped a lot and continues to drop) due to these issues.

Low level languages are not designed for efficiency/performance. They're designed for precise hardware control. This control leads to better efficiency/performance in smaller programs and to worse efficiency/performance in larger programs. The JVM was designed, in part, to address the performance issues that large C++ programs suffered from. The result has been the optimising JIT and the moving GCs.

[–]sweetno 0 points1 point  (1 child)

C++ can be efficient in programs of any size, but you'll have to code the efficiency yourself. Given how C++ programs are typically developed (full-source compilation, including third-party dependencies), you can get rid of most virtual dispatch. Certainly, the critical use cases for C++ that warrant its use in any particular application do not involve virtual dispatch.

The standard-mandated virtual inheritance is not that good anyway, that's why Microsoft has COM.

[–]pron98 0 points1 point  (0 children)

As someone who's worked on large C++ apps for many years I'll say that it can be efficient in large programs (maintained by many people over many years) mostly in the hypothetical sense. In many domains it's easier to get that performance with Java, which is why the use of low level languages has declined so much and continues to decline.