I was writing a program that used strings as hash keys, and it performed
quite well, but when I switched it to use arrays of (unsigned-byte 8)
instead of strings, performance went *way* down. I tracked this down to
SBCL's sxhash implementation. Below is a proposed enhancement. I
wouldn't call myself fluent in writing Common Lisp yet, so suggestions
are welcome for improvements in style or efficiency. It isn't fancy, by
any means, simply making the hash a function of the first 4 vector
elements, if there are that many.
I'm not sure, but perhaps this code doesn't "honor" a vector's fill
pointer properly, if it has one. Suggestions for improving that also
By the way, my 2005-02-06 message to sbcl-devel with subject "SBCL
0.8.19 PowerPC Darwin segmentation violation near SB-IMPL::REHASH" is
very likely due to running out of heap space. Apologies for the noise.
Assuming that is the true reason for the crash, it would be nice if it
were more obvious when SBCL runs out of memory, what the reason for the
crash is. I'm guessing this wish has been brought up more than once before.