Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: Efficient buffering

Author: Robert Hyatt

Date: 12:23:45 03/08/01

Go up one level in this thread


On March 08, 2001 at 11:31:32, Peter Fendrich wrote:

>I'm completly reorganising my book and also trying to speed it up.
>
>Using the fread(buf,....) how can I find out the most
>efficient buffer size to use?
>
>Currently I'm using an index, that I'm maintaining, to find a place
>somewhere "near" in front of the searched book move where I will start and
>read forward in sequence until the right move is found.
>
>//Peter


If you want to go fast, I can suggest the approach I use.  My 64 bit hash key
is used to produce book keys, but a book position uses the leftmost 16 bits
of the _parent_ position, and the rightmost 48 bits of the resulting position
after playing the "book move".  That much is easy.  Now sort all these keys.
That will put all the book moves with the same "parent 16 bits" together.

I then store a big index on the front of the book file, at present 32768
indices, with each index pointing to the first move in the book with the
same common parent bits.

The benefit is that if you read in a complete "cluster" (all positions with
the same 16 parent bits) then you get _all_ the possible book moves from this
position (plus other positions since other parent positions will have the same
16 upper bits of course).  But since it takes _one_ I/O you are done.  Now you
just search for the right 64 bit key and if you find it you know that move is
a book move...

fast, easy, efficient.



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.