Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: Interesting numbers about hashing - 32 bits are clearly not enough

Author: Miguel A. Ballicora

Date: 21:20:18 12/06/01

Go up one level in this thread


On December 06, 2001 at 23:08:43, Robert Hyatt wrote:

>On December 06, 2001 at 22:51:48, Miguel A. Ballicora wrote:
>
>>On December 06, 2001 at 18:15:27, Robert Hyatt wrote:
>>
>>>On December 06, 2001 at 17:02:42, Slater Wold wrote:
>>>
>>>>On December 06, 2001 at 15:21:17, J. Wesley Cleveland wrote:
>>>>
>>>>>This problem is like the problem "How many people does it take before
>>>>>it is probable that two have the same birthday ?". The answer, which
>>>>>many people find suprising is 23. To calculate this, calculate the
>>>>>probability p, that two people have different birthdays = 364/365.
>>>>>Then calculate how many pairs of people n, you need before this is less
>>>>>than 1/2, p^n <.5. Then find the number of people g, which taken two at
>>>>>a time is >= n, g = n*(n-1)/2.
>>>>>
>>>>>The same method tells you how many different positions you can have
>>>>>before it is likely that two will have the same hash key.
>>>>>
>>>>>32 bits 77163
>>>>>48 bits 1.97536627683E+7
>>>>>64 bits 5.05693754118E+9
>>>>>
>>>>>
>>>>>Thanks to Cliff Leitch for providing a high precision freeware calculator.
>>>>
>>>>I agree.  It's time for 64 bits and integers.
>>>>
>>>>On Crafty right now, I cannot search for more than about 6 minutes a position,
>>>>or the node counter resets.  That's a bummer.
>>>
>>>
>>>This will be fixed in the next version.  Node counter is 64 bits.  And all
>>>uses of it are also 64 bits...  The only issue is going to be printing them
>>>out, which might take some minor source changes for windows.
>>>
>>>IE in GCC, %llu is the way to print an unsigned 64 bit int.  I will have to
>>>research what is needed for MSVC and then the commercial compilers for the
>>>various unix platforms, since the %ll was not included in the ANSI standard.
>>
>>What if you do not print nodes and you just print Mnodes or Knodes or Gnodes?
>>You caculate them the way you want and then make a division so it will
>>be a 32 bit int again but it will mean a different unit.
>>At that point, nobody will care if it is 8123234543 nodes or 8123234 Knodes.
>>This way is more user friendly and easier to port.
>>
>>
>>iguel x 1000000 (a.k.a Miguel)
>
>An unsigned int can go to 4 billion and change.  that is 4 trillion nodes if
>converted to K nodes.
>
>Good hardware today can easily go 3-4M nodes per second.  Say 4 to make it
>round.  that means 1M seconds or 2 years.  Safe for today probably.  But
>the problem returns in a few years.
>
>But the reason I don't like Knodes is debugging.  When I make a change to the
>search I want to see the _exact_ node count to be sure it doesn't change when
>it shouldn't.  Knodes would hide that.

I understand.
Then, what about writing your own function that creates a string from the
integer. Thas should be easy and easier to port to any compiler.
Quick and dirty suggestion to illustrate the idea:

int64tostring (long long x, char *s)
{ unsigned int a = x/1000000;
  unsigned int b = x%1000000;
  if (x>1000000)
  sprintf(s,"%d%d",a,b);
  return s;
}

then you use

long long x;
char buffer[64]
printf("nodes: %s\n",int64tostring(x,buffer));

Miguel






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.