Author: Andrew Dados
Date: 16:55:20 12/10/02
Go up one level in this thread
On December 10, 2002 at 18:51:43, Federico Corigliano wrote:
>Hello
>
>Mi chess program uses a structure for the hash entry of 24 bytes. If I need to
>use 8 MB for the hash table, then I have two options:
>- Set the number of entries in power of two (262144 * 24 = 6291456 bytes)
>- Set the number of entries: (8*1024576)/24 = aprox. 340000 entries
>
>The second fill more the space asked, but I read that hashtables in power of two
>are more efficient.
In old days of 186 processors operation modulo was costly comparing to logical
AND. Now this is totally outdated (integer division takes one clock), so setting
hashtable size as power of 2 doesn't give any speed advantage anymore.
So you may calculate your hash number as (hashnumber mod hashentries){beware of
possible negative result here} instead of (hashnumber AND 2^n-1) and not be
limited to set of hash sizes you may allocate.
-Andrew-
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.