Computer Chess Club Archives


Search

Terms

Messages

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

Author: Peter Kappler

Date: 23:46:01 11/27/01

Go up one level in this thread


On November 27, 2001 at 13:15:19, Dann Corbit wrote:

>On November 27, 2001 at 06:14:38, Ralf Elvsén wrote:
>>On November 26, 2001 at 20:39:57, Dann Corbit wrote:
>>>On November 24, 2001 at 15:53:21, Kevin Stafford wrote:
>>>>On November 24, 2001 at 15:40:24, Tom Kerrigan wrote:
>>>>>C# is more or less the same as Java, so to answer your question, no, there will
>>>>>not be many chess engines written in C#, just as there are not many written in
>>>>>Java.
>>>>>
>>>>>-Tom
>>>>
>>>>C# is not more or less the same as java. They share a similar syntax, but there
>>>>are major differences in the implementation. C# as a I understand it provides
>>>>the option of native compilation, so that there is no VM layer. Even natively
>>>>compiled it won't be as fast as C or even C++, but should be measurably faster
>>>>than java. Whether it will be suitable to chess applications, its still to early
>>>>to say.
>>>
>>>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.
>
>>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.
>

Dann, that's a pretty poor explanation of why GC is "unfathomably lame".


>>>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.


I think it's more like 1.5x, perhaps as high as 2x.  Modern just-in-time
compilers are very good.

If I thought I could get a 4x speedup, I would switch to C++.


>  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?


Or the great sense to write it in Assembly?  ;)

-Peter



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.