English

Non-minimal k-perfect hashing: Tight lower bounds and an application to fast static hash tables

Data Structures and Algorithms 2026-07-08 v1

Abstract

A minimal perfect hash function (minimal PHF) is a data structure mapping a static set of nn keys to nn bins without collisions. Two natural generalizations are minimal kk-PHFs where nn keys are mapped to n/kn/k bins of capacity kk each, and (non-minimal) PHFs with load factor α<1{\alpha} < 1 where the number of bins is increased by a factor of 1/α1/{\alpha}, resulting in spare capacity. While there has been a recent surge of interest in perfect hashing generally, non-minimal kk-PHFs have not been systematically studied despite a natural use case of speeding up static hash tables: The idea is that a small cache-resident kk-PHF maps each key xx to a cache-line-sized bin of capacity kk where xx resides. Ideally, this yields a branchless lookup operation with a single cache miss working at high load factors for positive and negative queries alike. Our main theoretical contribution is to determine tight space lower bounds for kk-PHFs for all pairs of α(0,1]{\alpha} \in (0,1] and k1k \geq 1. It turns out that combining α<1{\alpha} < 1 and k2k \geq 2 drastically reduces the space of kk-PHFs, e.g. for (k,α)=(16,0.8)(k,{\alpha}) = (16,0.8) the space lower bound is 0.0270.027 bits per key while for (k,α)=(16,1.0)(k,{\alpha}) = (16,1.0) and (k,α)=(1,0.8)(k,{\alpha}) = (1,0.8) the lower bounds are higher by factors of 8\approx 8 and 32\approx 32, respectively. On the practical side, we develop a kk-PHF based on PtrHash and tune it for use in static hash tables. Empirically, our implementation produces kk-PHFs of size roughly 50%50\% above the lower bound. A static hash set based on this kk-PHF is consistently at least as fast as other hash sets for negative and mixed queries. On two of the three tested architectures it achieves up to 1.5×1.5\times speedup for large n30Mn\geq 30M where a 11-PHF does not fit in cache.

Keywords

Cite

@article{arxiv.2607.07257,
  title  = {Non-minimal k-perfect hashing: Tight lower bounds and an application to fast static hash tables},
  author = {Ragnar Groot Koerkamp and Stefan Hermann and Peter Sanders and Stefan Walzer},
  journal= {arXiv preprint arXiv:2607.07257},
  year   = {2026}
}

Comments

Accepted to ESA 2026; 27 pages; 7 figures