[Openmcl-devel] Hash Table anomaly -- hash-table-size decreases - wondering how this can happen

Gary Byers gb at clozure.com
Sun Jan 4 10:37:46 PST 2015


On 01/03/2015 07:10:35 AM, Glenn Iba wrote:
> Raymond,
> 
>   Thanks for the quick response.   Is it definitely the case, then,  
> that a
> GC can trigger rehashing?

A hash table can need to be rehashed for either of two distinct reasons:
1) it's "full" - the number of key/value pairs that have been added to  
the table exceeds some threshold that's related to the size of the  
table.
2) some of the keys in the table are hashed by address and the GC has  
changed the address of one or more keys in the table, This is not  
related to the size of the table; it is related to the hash table's  
:TEST function and to the types of objects used as keys in the table.

The value of the :size parameter to MAKE-HASH-TABLE doesn't have much  
to do with the "size" of the table after it's been rehashed (for either  
reason); the values of the :REHASH-SIZE and :REHASH-THRESHOLD should  
(and AFAIK they do.)

There's a lot more that could and should be said about this, but if  
you're thinking that making larger hash tables will avoid rehashing  
because of key movement (case (2)) you're mistaken.




More information about the Openmcl-devel mailing list