Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: Is C# best ideal for any chess programming?

Author: Ralf Elvsén

Date: 01:48:32 11/28/01

Go up one level in this thread


>>>
>>>There are compilers for Java also.
>>>Even with these compilers, performance still pales.
>>>There is no dynamic memory allocation in either Java or C#.
>>
>>I don't see why this is relevant. I have written chess programs in
>>Java and C. I use dynamic memory allocation in neither version.
>>In fact, I avoid it just because it is slow.
>
>Dynamic data structures.  Hash tables, Skip lists, AVL trees, etc.

Not sure what you mean. I have hash tables...

>
>>Besides, when an object is created in Java, as far as I understand it,
>>this is analogous to a call to malloc. You just don't have to
>>call free :)
>
>Garbage collection is unfathomably lame, and one of the chief faults of BASIC
>and Java.  It is a key reason why it can not be reliably used for real time
>systems.

No sane chess programmer creates new objects in the search. Therefore
all the GC has to do is to see that there is nothing to clean up.
I would be very surprised if this gives an overhead even close to 1%.

Besides, there is an RT-extension to Java, which allows you to
tag sections of your code as critical in the sense that GC is
not allowed there. But since this is not an issue in a chess
program, I wouldn't bother.

>
>>>Therefore, it is unspeakably lame as a language for writing chess engines.
>>
>>Tell Peter Kappler...
>
>I assume he has written a Java chess program?  I predict (then) that it is 2-4x
>slower than the equivalent C program.  A small, fixed constant (it is true) but
>the equivalent of a 2-4x CPU speed increase or about 100 ELO.  In short, I think
>it is silly to write chess programs in Java.  If you are truly an expert, you
>might write better algorithms to make up the difference.  But if that were the
>case, why wouldn't you have the good sense to have written them in C or C++ in
>the first place?

In another post Peter estimated the "penalty" for using Java to a
factor 1.5 - 2, which is in line with my own estimation.
It is high enough to chose C/C++ if you are really serious
about your program. But I wouldn't call it "unspeakably lame as a
language for writing chess engines". A Java fan writing a hobby engine
should stick to Java IMHO.

Ralf



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