On Mon, 2005-03-07 at 14:19 -0600, brian wrote: > > > First of all, Java is interpreted, so it never can be as fast as a > > > language, such as C++, compiled into native code CAN be. > > > >Sorry, but no, Java is a compiled language. It is normally compiled to a > >virtual machine code, and not to the machine code of a specific > >processor. But, it can be compiled directly to native machine code. The > >virtual machine code generated by a Java compiler can be interpreted, or > >it can be recompiled into native machine code. The majority of Java run > >times compile Java byte code into native machine code. You might say > >that Java is a twice compiled language :-) > > > >The result is that Java on typical computers runs as compiled native > >machine code and is just as fast as any other compiled language running > >on those machines. OTOH, if you are willing to give up speed for space, > >you can run Java on a virtual machine in a tiny amount of memory. The > >best of both worlds... or the worst depending on your point of view. > > Well, yes I know it is technically a compiled language, and I figured > someone would stick me for saying it was interpreted. :) > > I assumed that the vast majority of platforms would be running on virtual > machines interpreting bytecode. In that case, I think I could make an > argument for Java being an 'interpreted class' language, even though > strictly speaking its compiled into bytecode, since it would still incur > most of the spend penalties of interpreted languages. > > I guess that's an outdated assumption. :) > > If the virtual machines actually compile down into native code, then a lot > of my beef with Java performance goes away. I had heard about experimental > stuff with gcc compiling java into native code back in 2001, but never > messed with it. > > This makes me feel a little better about using a couple of Java projects I > was interested in. I just couldn't see how a Java based full-text search > engine would be fast enough. > > Guess I'll have to bite my lip about Java performance from now on unless I > can have some empirical results to show. I just know that in my OOP class > in 2001 we wrote a simple 'maze traversal app' first in C++, and then > ported it over to Java. The performance hit was absolutely huge, and since > then I've always regarded Java performance as something of a joke. Java has made a lot of progress since 2001. One the one hand, this is an example believing that things are still the same way they were yesterday. It is a hard lesson to learn, but everything changes when you aren't looking. In software, I figure if I haven't looked at it in a couple of years I don't know anything about it :-) really things change *so* fast :-) On the other hand, even if you were using a real good Java run time, the total run time of the program may not have been long enough for the runtime to convert the code to native code and then to optimize it. The Java runtime systems seem to be optimized for handling long running programs, not so much for short programs. Java can be deceptive because it doesn't work the way people expect it to work. I would not be surprised to find that Java is slower than C/C++ for small programs with short run times simply because part of the job of compiling Java is done at run time. OTOH, especially if you are using the latest Java HotSpot runtime systems, I would expect Java to perform just as well, or even better, than C/C++ for large long running programs. Personally, there are programs I write in C, and programs I write in C ++, and other programs I write in Java. I really like the run time error checking in Java. Bob Pendleton > > brian. > > > >The problem with using Java on the web is that the Java virtual machine > >in IE sucks. It is ancient, has no modern Java features, and is sloooow. > >Gee, didn't MS get sued, and lose, for its deliberate attempt to destroy > >Java? Why yes, they did. Paid Sun a billion or so for their nasty dead. > > > > Bob Pendleton > > > > --------------------- > To unsubscribe go to http://gameprogrammer.com/mailinglist.html > > > --------------------- To unsubscribe go to http://gameprogrammer.com/mailinglist.html