Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: Beowulf hot spots shown pictorially

Author: Sune Fischer

Date: 04:28:28 06/22/02

Go up one level in this thread


On June 22, 2002 at 06:40:59, Dann Corbit wrote:

>On June 22, 2002 at 04:35:04, Sune Fischer wrote:
>
>>On June 21, 2002 at 17:08:43, Dann Corbit wrote:
>>
>>>On June 21, 2002 at 15:45:11, Dieter Buerssner wrote:
>>>
>>>>On June 21, 2002 at 15:23:40, Robert Hyatt wrote:
>>>>
>>>>>why not replace that long long module with
>>>>>
>>>>>address = (int) (hash_signature) % table_size
>>>>
>>>>I suggested something similar. I am too lazy to check exactly, but it seems that
>>>>the cast to (signed) int will introduce a bug. Preferably would be a cast to
>>>>unsigned, or even better to size_t (In my suggestion I used unsigned long, which
>>>>will work on compilers with 16bit int and an adress space > 16bit, but those are
>>>>outdated. I still have one and use it now and then ...)
>>>>
>>>>BTW. adress might be a bit misleading, because adress IMHO seems to imply a
>>>>pointer, while it actually is a index/offset/whatever you want to call it.
>>>
>>>I tried this:
>>>
>>>Changed type of NHash:
>>>unsigned        NHash;
>>>
>>>Changed hash index calculation to this:
>>>unsigned       *pHash = (unsigned *) &Hashkey;
>>>unsigned        aHash = pHash[0]^pHash[1];
>>>hashentry = aHash % NHash;
>>>
>>>It's a heck of a lot faster and does not seem to introduce any problems.
>>
>>Could you explain the point of this:
>>>unsigned        aHash = pHash[0]^pHash[1];
>
>I wanted to use all the bits of the hash instead of just the lower 32 bits.

There is no reason for that IMO, the lower 32 bits are pseudo random and you
don't get much more random by XORing with the upper 32 bit pseudo random key.
Crafty does a simple AND, which is a mere ~22 bits of pseudo randomness for the
entry.
I think 32 is way better than 22 already, and if 22 is good enough for Crafty...
:)

-S.

>>and why is it faster than what Bob suggested:
>>hashentry = (unsigned int) hkey % table_size
>
>For sure, it's slower.



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.