From: chyde
Subject: RE: Hash Tables
Date: 
Message-ID: <2veiqv$su3@info-server.bbn.com>
humongous quantities of appreciation to all those who supplied info.

there were two problems.

I discovered this at my customer's site last week, where I coudn't
debug.  fortunately, it was repeatable here, where I can.

the first is that I was using SXHASH and shouldn't have been. it doesn't
do a good job with arrays.

#+allegro

(= (sxhash #(65537 32 71)) (sxhash #(65537 34 7))) ==> T

OOPS! those two arrays refer to extremely different things.

#+explorer

(sxhash (make-array N)) ==> N

DOUBLE OOPS! all keys look alike. can't have that!

also, I needed to have been using an EQUALP hash-table. EQUALP as the
test compares arrays properly. since my keys are always length = 3,
applying the test is relatively painless.

(time (dotimes (i 1000) (gethash #(65537 34 7) *my-table*))) ==> 83 ms.

the time consumed for an eql table was 50 ms. not radically different as
far as my needs go. my hash-table is for low-volume occasional use. in
any given session with my app, it might get called 1000 times over the
course of several days...

anyway, I made the changes, and things appear to be fine. I am also
going to put in a little check so that if this occurs again, I'll get a
warning rather than a bad (and incomprehensible error).

I certainly learned quite a bit here...

 -- clint