more default hash functions Alex Shinn (16 Oct 2015 01:57 UTC)
Re: more default hash functions taylanbayirli@xxxxxx (16 Oct 2015 13:53 UTC)
Re: more default hash functions Alex Shinn (16 Oct 2015 14:30 UTC)
Re: more default hash functions taylanbayirli@xxxxxx (16 Oct 2015 16:12 UTC)
Re: more default hash functions Alex Shinn (16 Oct 2015 23:50 UTC)
Re: more default hash functions taylanbayirli@xxxxxx (17 Oct 2015 12:30 UTC)

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

Alex Shinn <xxxxxx@gmail.com> 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.

Taylan