Home » GeekSpeak » Java Vs. C/C++ – when speed is an issue

Java Vs. C/C++ – when speed is an issue

So, I’ve had a project or two at The Firm that has required a little C programming. Being on the systems side of the company these days, you sometimes have to open up OpenSource code and make some alterations or add features. Most system code is written in C or C++. Anywho, With my C hat on, I was playing around over the weekend and decided to take a few minutes and learn how to program MySQL databases using the C API. After about an hour, I was able to get some stuff running. I decided that I needed bigger data sets then I was using to see how fast it would go, so I decided to do some queries against the telecom database that I’ve been writing my Java telecom application against.

Well .. let me help dismiss a myth. I ran my Java app agains my C app. The apps did the exact same thing. They ran the same queries and stored the same data. The C program whooped the Java program in terms of speed. It wasn’t even close. Same code, off the same server, to the same database, with the same queries and the same datasets. It wasn’t even close.

I have no allegiance to either language as a development platform. I use them both equally. There are a few articles that claim that Java is faster then C/C++, but its simply not true. I found this link to support my theory and dismiss the Java faster then C/C++ myth. I realize that a lot of Java developers will scream when they read this .. but too bad.

My test wasn’t a true benchmark test, but as a developer, I’ve noticed the difference (since I work with both languages). Sure development is quicker in Java, but if performance speed is an issue, its not something I would use. There’s a reason that no Operating Systems are written in Java, Its because its not fast enough.

http://parand.com/say/index.php/2005/11/27/why-java-is-slow/

Leave a Reply