I have been following this thread on and off and there are a few things that puzzle me.
Before I continue, I am not anti-Java. I see Java and C++ as solving quite different sets of problems. C# would seem to be a more appropriate competitor for Java.
But statements that heap allocation or threading is faster in Java than C++ don't make sense to me.
If you are saying that you believe it's easier to write efficient threading/etc code in Java than C++, fine. But what limits the performance is that of the threading library or heap manager. which is being used. (The fact that Java provides a standard threading library whereas C++ doesn't is a separate issue)
I have just had a look at the Java installation on my Windows XP machine, and I can see -- thanks to depends.exe [1] -- that jkernel.dll is using kernel32.dll's CreateThread and HeapAlloc call's, so WIN32 has been used to implement it.
Furthermore, PEID [2] reports that jkernel.dll (1.6.0_25) was built with Visual C++ 7.1. So the Windows version of Java's speed is reliant on not only the performance of WIN32 but the speed of a runtime library written in C/C++.
I am also curious as to how a Java virtual function call can be faster than a C++ virtual function call. The cost of the C++ vtable mechanism is a pointer dereference plus an array offset (cf. calling a non-virtual method through a pointer). Does Java manage to avoid one of these somehow?
To end, referring to another thread: "isn't multilple languages a sign of bad?"
http://www.cplusplus.com/forum/lounge/48709/
I think there is plenty of code that it would be a bad idea to write in C++. But the same holds for all other languages, including Java. I expect to work with mixed languages and libraries when working on a non-trivial project. It's as far from bad as possible!
Andy
[1]
http://www.dependencywalker.com/
[2]
http://www.peid.info/
Not sure how much I trust this little app, but it correctly reports the versions of various -- but not all -- other files (sometime it can't work it out). But as jkernel.dll links to MSVCR71.dll, which uses C++ linkage, it must be compiled with Visual C++ 7.1