Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: Efficient buffering

Author: Peter Fendrich

Date: 14:49:32 03/08/01

Go up one level in this thread


On March 08, 2001 at 15:23:45, Robert Hyatt wrote:

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

I think I'll steele your big index idea instead of my "small" index that
made things unecessary complex. Do I understand you right here that you
read in a variable buffer size? All between Index and Index+1.

Why do you combine from- and to-hash like that?
I use the from-hash only and combine it with a compact form of the move.
The 16-bit index is the leftmost part and if the rest of the key matches the
from-hash as well I know that the move is OK. (I test for collisions when the
book is build).
//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.