Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: Java versus C Speed Comparison

Author: Matt Taylor

Date: 16:40:58 01/06/03

Go up one level in this thread


On January 06, 2003 at 14:20:38, Robert Hyatt wrote:

>On January 06, 2003 at 12:36:19, Graham Laight wrote:
>
>>On January 06, 2003 at 08:51:31, scott farrell wrote:
>>
>>>>single cpu K7 1.6Ghz 70k nps - 80k nps for DIEP.
>>>
>>>That seems extremely slow.
>>>
>>>Crafty does about 600Knps on about a PIII-1000.
>>>
>>>My little chompster under java does about 70-80Knps on a PIII-1000, it is bit
>>>board also (dare I mention that?).
>>>
>>>I am guessing that you are using compiled c/c++ and maybe some assembler.
>>
>>Java is a compiled language - it ought to be nearly as quick as C.
>>
>>Does anyone have compilers for both languages?
>>
>>It would be very interesting to do a simple for loop (with a simple action in
>>the loop) to compare the relative speed of the two languages.
>>
>>One big advantage of Java is, of course, that it can be used on any platform
>>which has a JVM - thus eliminating compatibility problems in theory.
>>
>>Also, is your Java chess program on the WWW?  If so, please post the address.
>>
>>Take care,
>>-g
>
>If you are talking about a JVM, then you are _not_ talking about a "compiled
>language".  There is a _huge_ difference between executing some sort of
>pseudo-code vs native machine language instructions.  A native JAVA compiler
>could work just fine with care, but not one that needs the virtual machine to
>run.  It will _never_ come within a factor of ten of a well-written C program.

The JIT versions aren't terrible. IBM's is supposedly the fastest for x86. After
the initial JIT penalty, the Java program runs approximately as fast as the C
program. A good JIT compiler can even reduce the JIT overhead to <10%.

Alas, native Java compilers are not very popular. I have never used one, but I
would be suspicious of performance. It would be better than JIT, but it probably
would not be quite on-par with C/C++ either.

-Matt



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.