So I have recently been learning java and everywhere I go I hear that java is a slow language compared to C or c++. I know that when it came out in the 90's that it was a lot slower, but I was wondering how much slower is it today. Also when writing java programs do you ever really run into issues with how slow it is?

javaAddict commented: For the signature. +13

Recommended Answers

All 5 Replies

Member Avatar for GreenDay2001

Well performance is hardly an issue for most applications(as its unnoticeable). Java is being successfully used in several areas. I'm not a good/experienced Java programmer, but the reason people use languages like Java, C#, Python is the increased productivity.

You can search for benchmarks or make yourself and see. The reason Java is slower than C/C++ is because Java is compiled into Bytecode which is interpreted during runtime by JVM. C/C++ on other hand is compiled to native code(the machine code you call).

If some Java application needs performance boost in specific areas, you can write those part in C and interface it with jav using JNI.

ah thanks that clears a lot up.

It's a myth that Java is slow. The JRE is highly optimised and performs comparably to ordinary C++ code. Only in the most performance-critical CPU-intensive tasks will you see any real benefit from properly tuned C++
Have a look at
http://scribblethink.org/Computer/javaCbenchmark.html
that was 2004, but the JRE has only improved since then.

Hmm why not test yourself. Write a test application that does the things with standard libraries and primitive constructs.

The problem with Java is not running slow but memory usage I think. You can watch and read what Stroustrup explains about Java, C# and C++.

I don't normally opt to use applications written in Java because they seem to not be as responsive on my system. If an application written in a different language is available I normally choose it.

If one day soon bleeding-edge PC games are written in Java I will be surprised, but until then I think C/C++ is really the performance king.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.