A Swiss Table is a form of open-addressed hash table optimized around cache-line-sized groups. The key to having an efficient hash table is the probe sequence, i.e. how to choose in which slot to put keys or how to retrieve them.

Swiss tables break the array into logical groups of 8 slots each. Each group has an associated 64-bit control word where each byte stores the state of one slot:

  • empty
  • deleted
  • in use, in which case it stores , the lower 7 bits of the hash

The complete hash is 64 bit, split as:

  • (upper 57 bits): used to select the group
  • (lower 7 bits): stored in the control word as a fingerprint

In insertion or lookup, after selecting the group with instead of linear scanning to find the slot, we check the control word first. Since the control word is 64 bits, all 8 slots can be check simultaneously with SIMD. Only if a byte matches then the full key comparison is done.

See Also

References