<< September 10, 2004 | Home | September 12, 2004 >>

Java Faster Than C++? No Way!

Ever since 1995, the Java world has been fascinated with talks and benchmarks which shows why Java should be/could be/would be/is faster than C++.

At first it was the JIT:

When Java gets a JIT, it would be faster than C++.

Then it was the HotSpot:

When the HotSpot is done, Java would be faster than C++.

Now it is the benchmarks:

Professor So-and-so did a benchmark, and guess what, Java is faster than C++.

And the well-argued theories:

The garbage collector is faster than hand collection for the same amount of garbage.

But my experience tells me that Java is slower than C++:

  • My Java based "Hello, World." program is slower than my C++ "Hello, World." program.
  • My Java based Java compiler is slower than my C++ based Java compiler.
  • My Java based IDE (wonderful as it is) is slower than my C++ based IDE.
  • My Java based JavaScript interpreter is slower than my C++ based JavaScript interpreter.

Java has many advantages over C++. Performance is not one of them.

The good news is that the Moore's Law and cheaper memories has done a lot more to boost Java's performance than anything else. Java is the appropriate technology in more and more applications.