Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: hash table size - is a power of 2 still an advantage these days?

Author: Robert Hyatt

Date: 16:57:57 09/24/03

Go up one level in this thread


On September 24, 2003 at 16:45:20, Sune Fischer wrote:

>On September 24, 2003 at 16:31:37, Robert Hyatt wrote:
>>"Think outside the box".
>>
>>the power of 2 is _not_ a memory address.  It is a hash table index.  If
>>an entry is (say) 48 bytes (in Crafty this is true as a single hash probe
>>accesses a "bucket" of three entries, one depth-preferred entry and two
>>always-store entries.)  This means that my hash sizes are 3/4 of a true
>>power of two, which is why I use sizes like hash=48M, hash=96M, up to
>>hash=768M on my 1gb dual xeon box.
>>
>>That lets me use 3/4 of memory for hash (transpositions/refutations) and 1/4
>>for the rest of the stuff like pawn hash, egtb cache, and whatever else I have
>>in the program.
>
>Suppose you had only 512 MB, then you would have to choose between 384 MB or 192
>MB.
>The 384 might cause swapping and it has to be allocated in one big continues
>block might not even be possible, so you'd have to all the way down to 192 MB.
>

No current system allocates contiguous memory, except for the Cray.  So that
isn't an issue, since we allocate pages and piece them together into a
contiguous block via the memory management hardware.  That isn't a problem.

However, I've never had a system where I could not use 3/4 of memory _at least_
for hashing.  IE for a 512mb system, that is 384mb.  That still leaves 128mb
for the OS and the program itself, and filesystem cache, and egtb cache, and
pawn hash, and whatever else...




>Compare that to a program which is able to slide right in below the 384 MB, say
>350 MB where no swapping occurs.

I won't argue that the idea of non-power-of-2 is not a good idea.  I just
haven't seen any real need for it myself, and I know that the AND is always
fast, while integer divide is not, particularly when talking about 64 bits,
which means you have to load the two pieces into eax:edx first, then do the
divide, to get the remainder.

>
>-S.



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.