Computer Chess Club Archives


Search

Terms

Messages

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

Author: Dann Corbit

Date: 17:40:29 05/15/01

Go up one level in this thread


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

Impossible to say.  If crafty were implemented in Java (we'll say that all
malloc() calls were replace by fixed arrays of sensible size) it would be about
1/4 as fast as the original.  So you could get a speedup of about 2.5 but you
will level off there.  Also, the inline assembly will be a problem because
you're not supposed to be able to do that in Java.  So (then again) you may
already be at maximum performance.

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

If you can get 10% of crafty's speed with that going on, I'd be delighted.  I
suspect after it has been playing for half an hour or so, you'll be getting 1%
of crafty's performance.

Amyan's author wrote a very similar engine in both languages.  He can probably
give you some more details on the performance differences.



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.