Java Performance

In the old days, there was much concern that Java programs were slow and could not complete with C or C++ programs. It seems that this is not as true any more. I just read a huge discussion on the topic. Here are some interesting points I came out with.

C has a small footprint. So if that is required, choose C. Java has a long startup time. This is the time it takes for the JVM to load and initialize. We are talking on the order of seconds here.

Direct machine access can be done with Java using JNI. However it is clunky. In C, direct machine access is natural. However garbage collection in Java is easier than C's malloc/free. Java also make parallel programming easier.

Be careful when you are comparing speed between Java and C programs. You must ensure both programs are using the same algorithm. You also need accurate stats to make a good comparison. As an aside, C# will normally be a little bit slower than Java.