Lisp HUG Maillist Archive

Custom Hash Functions

I have several hash-tables with compound keys. The elements of the key are 
CLOS objects. I've been using a list to bind key elements together. When I 
do a hash lookup, I declare the key as dynamic-extent, which successfully 
eliminates any allocation. So far so good.

One issue, though, is that the use of a list is forcing me to use an 
"equal" hash table. My performance tests seem to indicate quite a 
significant difference between "eq" and "equal" hash tables. I'm not sure, 
but I wonder if the "equal" hash table is also performing an "equal" test 
on my objects. (Is such a thing even possible?) If so, that's far more 
than I need; an "eq" test on the objects themselves would be sufficient.

So: *if* the above is correct, it looks like a custom hash function is 
just what I need. I was thinking of perhaps XORing the sxhash values of 
each of the objects. Does that make sense? (There are no examples of 
custom hash functions to use as a starting point.)


Unable to render article 2179 because of ":DEFAULT stream decoding error on #<SB-SYS:FD-STREAM for \"socket 192.168.43.216:64796, peer: 116.202.254.214:119\" {1006890AD3}>: the octet sequence #(246 115 99 104) cannot be decoded." error

Re: Custom Hash Functions

> No, two CLOS objects are EQUAL if and only if they are EQ.  Same goes
> for EQUALP, although the latter would descend into structures.

And thanks again...


Updated at: 2020-12-10 08:57 UTC