Re: more default hash functions taylanbayirli@xxxxxx 16 Oct 2015 13:53 UTC

Alex Shinn <> writes:

> eq?/eqv? hash tables with rehashing on gc,
> as in larceny, may be doing more work than
> is needed for some common eq?/eqv? cases.
> If the keys are only symbols, it would be
> reasonable to store a hash value directly in
> the symbol object, or even arrange for all
> symbols to be stationary in the gc. To allow
> such optimizations, I think we should add:
> make-symbol-hash-table
> (which may just be the same as an eq table.)

I believe (make-hashtable symbol-hash eq?) should suffice?

> Similarly, a possibly rehashing eqv table is
> overkill for characters and numbers when we
> can just construct normal comparison-based
> hash tables using:
> char-hash
> number-hash
> One could also consider char-ci-hash, though
> case comparisons on single chars may be
> indicative of poor design.

I'm indifferent.  I think adding char-ci-hash, char-hash, and
number-hash would be neither very useful, nor harmful.

If it provides a nontrivial performance gain on Scheme implementations
with moving garbage collectors that rehash eq? and eqv? tables after
every GC, then why not.