-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On Thursday 04 March 2004 02:54 am, John Lamb wrote:
I don't recall offhand because I agree that bencharks are not that important. I found one packing algorithm I wrote in both java and C++ took about 5 times as long in java than in C++ compiled withouth optimisations. For a more extreme comparison, try big matrix multiplication and compile the C++ code -O3 -mfpmath=sse -msse -msse2 -maling-double.
But is that innate to the language and the differences between byte compiling and assembling, or is it simply that C++ has libraries, and compiler features which support this kind of thing? Again, I have to refer to Java3D. I'm not sure how the javax.vectormath package would stand up, but it would be a likely place to look for optimized math algorithms. http://java.sun.com/products/java-media/3D/forDevelopers/J3D_1_3_API/j3dapi/... A thing to consider is that once the instructions are loaded in memory, the byte code interpretation issues are irrelevant. It's just a question of the algorithms being used, and the way the VM was compiled. If it's written in C++, guess what? :-) There are also ways to use .so's with Java. My guess is, such areas of optimization can be isolated in most cases. If so, and if they are going to be used by many different programs, or in many different parts of a large project, they could be written in C++. Bear in mind that the compiler you get from www.javasoft.com is just a reference implementation. There are other VM's such as IBM's.
But, as you suggest, speed is usually not the issue. Robust and quick development is. That's where I think java wins. I'm hopeful that what gcj will do is allow java to run at similar speeds to C++ and FORTRAN.
Part of the problem with C++ is simply the lack of good supporing tools. I'll say this again. KDevelop is the best thing going for C++ open source. http://www.kdevelop.org/graphics/pic_corner/3.0/full_ide.png
Of course that won't convince all C++ programmers to change. I still get FORTRAN programmers ask me why I use C++ (they still think it's much slower) - and they can't even recurse!
If I understand correctly, gcc converts all the source code it compiles into a generic transcode(?) before assembling. I'm wondering how much the particular language used to create the source will matter, if that's the case. I'm certainly not out to kill C++. I believe it's good to have alternative languages. Java took a great deal from C++. The C++ community could learn a lot by examining why Java is so attractive to programmers. What are the meanings of these these expressions? const char* bears[3] = {"Papa", "Mama", "Baby"}; char* const bears[3] = {"Papa", "Mama", "Baby"}; // I find this bizarre! const char* const bears[3] = {"Papa", "Mama", "Baby"}; See: Ellis & Stroustrup, pp 133-134
JDL
STH -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.2 (GNU/Linux) iD8DBQFARx0EwX61+IL0QsMRAtiQAKCYh/ZA/po7O4WWU32iYj3tr8E4GQCgr00b nRoOvC8355rMyp5BuUFjwPA= =l9dS -----END PGP SIGNATURE-----