Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: Java versus C Speed Comparison

Author: Graham Laight

Date: 02:17:20 01/07/03

Go up one level in this thread


On January 06, 2003 at 19:33:18, Matt Taylor wrote:

>On January 06, 2003 at 13:33:24, Russell Reagan wrote:
>
>>On January 06, 2003 at 12:36:19, Graham Laight wrote:
>>
>>>Java is a compiled language - it ought to be nearly as quick as C.
>>
>>It's only compiled to byte code, not machine code, so there is still some
>>interpreted-like behavior going on. I have heard that Java is about 2x as slow
>>as its C/C++ equivalent. One additional thing that I think will slow Stuart down
>>is that he is using bitboards in Java. I have never tried myself, but I have
>>always heard that bitboards in Java are slow (when compared to bitboards in
>>C/C++).
>
>Rumor has it that platform-specific Java compilers exist. I've never seen one. I
>can't vouch for the 64-bit performance of Java, though I would have expected it

This is surely dependant on the compiler which is available for your particular
computer. I would think that by default, Java would be optimised for a 32 bit
processor.

>to be more mature in that respect than C/C++. Also, the JIT compiled JVMs are
>quite fast. You pay the JIT penalty once each time you start the program, but
>afterward it'll be running native code.

What you seem to be saying here is that you can have a Java compiler installed
into your web browser that will compile the Java code into machine code for the
computer you're running. If so, I assume this has to be installed separately -
and that the default is that that the Java applet comes as "tokenised" byte code
which your web browser interprets.

>There was some benchmark a long time ago on cnet or the like, can't remember
>where I saw it...anyway, it showed JIT performance exceeding C/C++ performance
>in some cases. That does raise eyebrows. Makes you wonder how poorly-written the
>C/C++ code was. Either way, it means that JIT code can be relatively fast.

To achieve this, either the program must have been compiled to machine code, or
the test must have carefully selected operations at which a web browser happens
to be exceptionally good.

-g

>-Matt



This page took 0.03 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.