David Forslund <[EMAIL PROTECTED]> wrote: > > I have more than one example in which the Java is basically the same > speed > as compiled C. > That is, if you write "C" code in Java, you get about the same > performance.
I see. Indeed, there was a recent thread on the Python list presenting some benchmarks of some simple "C" code written in Python and executed with the Psyco JIT compiler, and yes, Python was about the same speed as compiled C (sometimes faster, sometimes slightly slower). But so what - they are completely artifical benchmarks. Real-life Python and Java code uses objects wherever it can (otherwise you might as well use C or Fortran), and in when used like this, I don't think either can claim to approach the speed of compiled C (or C++). However, I don't think that matters a jot - as you say, most applications spend their time waiting for other things (human input, databases, network events etc), so the speed and efficiency with which code can be written, not executed, is generally more important - and here both Python and Java win hands down over C. Enough said (by me at least) on this topic. Tim C > > The area where the slow down occurs is where one starts computing > with > objects in the inner loops. > The extra references in this case slow Java down. I think this is > basically due to the extra > overhead of objects, in general. Perhaps the JIT compiler should be > able > to optimize this out, > but so far, we have not seen it able to do this. In on sense, it is > the > same slow down one gets > from C++ unless you do a lot of hand optimization. The slow down > due to > objects is still > not bad and enables the code to still run fast enough in almost all > cases > we have dealt with. > Dealing with a database, we find that most of the time is spent in > the > database, not in our java code, > unless we do a lot of massaging of the data coming back from the > DBMS. > > We have seen substantial improvement of the JIT in the newer releases > of Java. > > Dave > > At 12:37 PM 11/9/2003, Tim Churches wrote: > >On Mon, 2003-11-10 at 01:10, David Forslund wrote: > > > Performance is not an issue, > > > since Java runs about the same speed as compiled C. > > > >Really? Real-life applications, not just trivial benchmarks loops > which > >the JIT compiler can optimise away? Our experience with Java has > been > >quite different - maybe that was a reflection of the underlying > code, > >rather than Java itself? Certainly I am prepared to believe that > Java is > >fast enough for just about anything, but as fast as compiled C? > > > >-- > > > >Tim C > > > >PGP/GnuPG Key 1024D/EAF993D0 available from keyservers everywhere > >or at http://members.optushome.com.au/tchur/pubkey.asc > >Key fingerprint = 8C22 BF76 33BA B3B5 1D5B EB37 7891 46A9 EAF9 93D0 > > > > >
