Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: Hash Table Collisions

Author: Tom Kerrigan

Date: 09:27:08 04/13/00

Go up one level in this thread


On April 13, 2000 at 02:46:33, Tony Werten wrote:

>On April 12, 2000 at 16:05:33, Tom Kerrigan wrote:
>
>>On April 12, 2000 at 14:03:21, KarinsDad wrote:
>>
>>>On April 12, 2000 at 12:08:37, Tom Kerrigan wrote:
>>>
>>>[snip]
>>>>
>>>>I don't care for this method because you have to go through your entire hash
>>>>table and set these bits. That takes about as long as clearing the hash table,
>>>>which makes it unreasonable to have large hash tables for fast games.
>>>>
>>>>What you can do is take any leftover bits in your hash entries and use them for
>>>>a counter. Every time you start a new search, you increment the counter. If you
>>>>find an entry with an old counter value, you can toss it.
>>>>
>>>>-Tom
>>>
>>>I like it. What size counter do you use? 2 bytes? 4 bytes? How large does your
>>>hash table get?
>>>
>>>KarinsDad :)
>>
>>I have a byte in my hash table entries to indicate what type of score the entry
>>is (alpha, beta, pv). That only takes 2 bits, so i use the remaining 6 bits for
>>a counter. So the counter can go to 64.
>
>Some small questions. How do you manage this pv score of you find a new pv ? Do
>you go through your old pv and remove the pv bit ?

There are three types of scores that you would save in a hash table. Lower bound
(alpha), upper bound (beta), and a perfect score, which I call a PV score. The
perfect scores basically happen when you find PV moves. (Also mates.)

>>I figure if an entry is lucky enough to avoid being clobbered for 64 searches,
>>it deserves to stick around for one more. :)
>
>I though about this. Normally this would go ok. But what about search 65 ? Your
>counter gets set back to zero, which is always smaller than the entries in your
>table, so you never get permission to store the new entry.

KarinsDad already answered this. BTW, if you have a counter like this, you can
effectively clear the hash table by ignoring entries with different counter
values. This means you don't have to do a monster memset at the beginning of
your search, so playing blitz games with huge hash tables is possible, even if
you want to clear them between moves.

>>I usually set my general hash table size to 16MB. I have 128MB RAM, but I like
>>to be able to just fire up my program with no swapping. I have no idea how fast
>
>On windows 98 with 128MB, I use 64 Mb for hashtables without any swapping.

I tried 64 and most of the time it didn't swap, but a lot of times it would swap
for a few seconds, especially if I was running something else at the time. This
isn't so bad, but if you're running your program over and over (debugging or
whatever) those seconds start to add up.

-Tom



This page took 0.01 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.