Computer Chess Club Archives


Search

Terms

Messages

Subject: Hash table allocation

Author: Peter Fendrich

Date: 12:20:22 08/26/03


My current hash size is a power of 2 entries where each entry is 12 bytes.
The main hash table is for instance 3M, 6M, 12M, 24M, 48M, 96M, 192M etc
If 88M is given to Terra 48M will be allocated (96M is too much). Then 40Mb will
be unused. How can we use these 40Mb with a good distribution of entries?
(I have more hash tables to combine with but let's skip that for now)

Some figures in this example:
             1 entry:  96 bits = 12 bytes
    Available memory:  88Mb
 # entries available:  7689557
Key for 88Mb (Key88):  23 bits (22 bits will cover 48Mb)
       Max for Key88:  96Mb (8388608 entries)

When computing the Key88 from my (64 bits) Hashcode some values will of course
be above the upper limit 7689557 (11101010101010101010101).
My first thought was to use modulo: Key88 %= 7689557
This will not be well distributed at all. The first 699051 entries will be
overused but maybe someware 699051 entries must be overused anyway whatever
method is used?
Is there a better way?
/Peter



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