Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: So how's Java these days? Still slow?

Author: Mark Christiaens

Date: 05:37:28 05/10/02

Go up one level in this thread


I've been working with Java extensively for my PhD (and also C, C++, ...) My
experience is that currently Java is a factor 2 slower than similar C code (with
maximum optimization) for tight loops.  If you go to heavily object oriented
languages, the difference may not be as large.  The main reason for this is that
C/C++ compilers compile one source-code module at a time and cannot optimize
over these boundaries.  JIT-compilers for Java see the whole application and can
for example inline methods from other classes which were not available at
compile time.  Some of them even inline speculatively and when new classes are
loaded undo incorrect optimizations.  The Jikes-RVM JIT compiler is said to
often inline to 10-levels deep!

Actually making a fair comparison between the two is very hard because there are
no (as far as I know) large, identical applications written in both languages.
All in all, I would catalogue Java as being slower but not that much.  You
always have the option to write large portions of your applications in Java and
write a few time-critical routines in native code (using the Java Native
Interface (JNI)).  You also get the added advantage of a huge amount of well
standardized libraries that will run on a lot of platforms.

Another point that might be interesting is that we're moving towards
JIT/interpreter language whether we want to or not: even Microsoft with it CLR
(common runtime layer I think) is moving C, C++, C#, VB to an interpreted
environment.

Anyway, great material for a flame war ;)





This page took 0.01 seconds to execute

Last modified: Thu, 15 Apr 21 08:11:13 -0700

Current Computer Chess Club Forums at Talkchess. This site by Sean Mintz.