Hasty Briefsbeta

Cuckoo hashing improves SIMD hash tables

15 hours ago
  • #hash-tables
  • #cuckoo-hashing
  • #performance
  • Cuckoo hashing is a hash table design that uses two hash functions and searches only a fixed number of positions during lookups.
  • Cuckoo hashing can be combined with SIMD-accelerated probing to outperform standard implementations in many scenarios.
  • For in-cache tables, cuckoo hashing wins by avoiding branch mispredictions and reducing instruction count.
  • For out-of-cache tables, cuckoo hashing's shorter probe length allows it to win, especially at high load factors.
  • Cuckoo hashing supports arbitrary table sizes, efficient table resizing, and does not require tombstone entries.
  • Cuckoo hash tables are a great wire format for sending dictionaries due to bounded probe lengths.
  • Different hash table layouts are optimal depending on the use case, with cuckoo hashing often being the best choice for load factors larger than 50%.