Skip to content(if available)orjump to list(if available)

Adaptive Hashing

Adaptive Hashing

6 comments

·May 8, 2025

heisig

Let me comment as an SBCL user: This is outstanding work, and I can now remove a lot of performance hacks from my code because the default hash tables became equally fast!

Also, this technique eliminates a number of worst-case scenarios and inefficiencies, which is a boon for any hash table user.

tptacek

Fun fact! A previous use of the term "adaptive hash" was as a descriptor for things like Bcrypt, which have the exact opposite goal (to consistently be as slow as possible regardless of advances in hardware).

90s_dev

"tptacek's law: given enough time, diametrically opposed algorithms will have the same name"

tptacek

Yes! See: quicksort.

null

[deleted]

vlovich123

> For string keys, hash only the first and last 2 characters. For list keys, only hash the first 4 elements.

I would think it make some sense to change these constants as the collision chain grows, thereby improving the hash quality of keys and avoiding collisions as the table gets larger and larger