Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: Java vs. C++ Chess Programming Question

Author: Vincent Diepeveen

Date: 07:25:17 05/17/01

Go up one level in this thread


On May 16, 2001 at 00:18:42, Bruce Moreland wrote:

>On May 15, 2001 at 20:28:25, Sam Gross wrote:
>
>>I am writing a bitboard-based chess engine in Java, and a preliminary test of
>>the search function (plain alpha-beta search, no transposition table, history,
>>null move, or anything else) was pretty disappointing.  I am getting about 10%
>>of the nps crafty gets on the same machine, even though my evaluation function
>>is just the material imbalance.  My question is, how much of this is due to
>>differences in speed between Java and C++, and how much is due to lack of a
>>transposition table (or other factors)?  Also, I wonder if my program may be
>>stretching Java's automatic garbage collectors.  A new copy of my board is made
>>for every node, and each node creates many instances of my move object, which I
>>imagine would use up a lot of time.  Any help would be appreciated.
>
>"new" is evil if it's used in an important part of a performance intensive
>application.
>
>It would be much more efficient to make an array of these things, and increment
>and decrement a pointer into the array when you enter and leave a node.
>
>bruce

I'm not a big JAVA expert but a major problem of JAVA is that
it doesn't have pointers.

The only way to index an array is by means of

  a[i]

anything like next is not working:

  *(a+i)  ,  *a++ = i , a = &movearray[i];

Nevertheless the few experiments i did with java over the course of
one full year (whole project in JAVA) i did get nullpointer after
nullpointer... ...which theoretical is not possible in JAVA as it
has no pointers...

You can ask a pointer from the system, but that's not how we WANT to use
a pointer in a chessprogram.

In short i quickly understood that JAVA will be never able to optimize
a program to the same extend as a C++ compiler can. A big penalty there
will always be for using JAVA.

C++ rules.

Best regards,
Vincent





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.