Papers
Topics
Authors
Recent
Search
2000 character limit reached

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

Published 8 Jul 2026 in cs.DS | (2607.07257v1)

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$ where the number of bins is increased by a factor of $1/α$, 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]α \in (0,1] and k≥1k \geq 1. It turns out that combining $α < 1$ and k≥2k \geq 2 drastically reduces the space of kk-PHFs, e.g. for (k,α)=(16,0.8)(k,α) = (16,0.8) the space lower bound is $0.027$ bits per key while for (k,α)=(16,1.0)(k,α) = (16,1.0) and (k,α)=(1,0.8)(k,α) = (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 n≥30Mn\geq 30M where a $1$-PHF does not fit in cache.

Summary

  • The paper derives tight lower bounds for non-minimal k-perfect hashing using analytic combinatorics and large deviation analysis.
  • It introduces a practical k-PtrHash construction that achieves space usage within 50% of the information-theoretic lower bound and supports over 300 million queries per second.
  • The research demonstrates that cache-friendly, static hash table designs based on k-PHF significantly outperform traditional schemes in large-scale and negative-query dominated applications.

Non-minimal kk-Perfect Hashing: Tight Lower Bounds and Fast Static Hash Tables

Introduction and Motivation

This work provides a systematic analysis of non-minimal kk-perfect hash functions (PHFs), presenting both new tight space lower bounds and practical algorithms for their construction and application in static hash tables. A kk-PHF for a static set of nn keys maps each key to a bin such that no bin contains more than kk keys. While minimal PHFs (kk=1 and load factor α\alpha=1) have a long history, their non-minimal kk-PHF counterparts with k≥2k\geq2 and load factor α<1\alpha<1 have not received comparable attention despite strong practical motivation for high-throughput, cache-friendly static lookup data structures.

The practical impetus derives from the ability to use kk0-PHFs as key-indexing mechanisms for large static sets: placing all keys in bins (ideally of cache line size) enables extremely efficient querying using a single memory access and SIMD or branchless search within a bin. The reduction in hash structure size (relative to minimal PHFs) allows retaining data locality for larger kk1 and high-load factors (kk2 close to kk3), thereby achieving significant performance benefits over traditional schemes in cache-constrained scenarios.

Theoretical Results: Tight Space Lower Bounds

The first main contribution is the derivation of tight space lower bounds for all combinations of kk4 and load kk5. The analysis generalizes and unifies previously disparate bounds by extending the brute-force seed-search argument—previously known to be optimal only in minimal cases—to arbitrary kk6 and kk7, using analytic combinatorics and large deviation analysis. This yields the following summary:

  • Brute-force Construction Optimality: Under a large-universe assumption, the brute-force approach—searching for a hash function seed such that no bin exceeds kk8 keys—is proved to be space-optimal for all kk9 and kk0. The space is roughly kk1 bits per key, with kk2 the probability that a random function is kk3-perfect.
  • Closed-form and Asymptotic Bounds: For minimal PHFs (kk4, kk5), space must be at least kk6 bits/key; for larger kk7 or smaller kk8, closed-form and asymptotic analyses reveal a dramatic reduction, with space decaying exponentially as slack increases. For example, kk9 yields a lower bound of nn0 bits/key—over nn1 times smaller than nn2.
  • Distributional Insight: The number of keys in a bin asymptotically follows a truncated Poisson distribution conditioned on the global load, leading to precise threshold phenomena and two distinct regimes depending on the slack parameter nn3 relative to nn4.

Figure 1

Figure 2: Space lower bound per key for various nn5 and load factors nn6, illustrating exponential decay as nn7 and slack increase.

These results both generalize prior special-case lower bounds and provide quantitative regimes where using larger nn8 and smaller nn9 yields sharply lower storage requirements.

Algorithmic Results: Efficient kk0-PHFs and High-Throughput Hash Sets

The second primary contribution is a practical extension of the PtrHash technique to the kk1-PHF case, yielding a kk2-PHF with tunable kk3 and kk4, and near-lower-bound space consumption. The bucket placement paradigm partitions the key set and greedily seeks a placement of keys in bins without exceeding the kk5-key per bin limit, with an enhanced scoring function designed to maximize future placement flexibility at each step.

Strong empirical results demonstrate:

  • Space Efficiency: The implemented kk6-PtrHash construction consistently achieves space within kk7 of the information-theoretic lower bound.
  • Construction and Query Throughput: The approach achieves over 300 million queries per second, outperforming state-of-the-art static hash set constructions on large real-world sets.
  • Cache Fit and Scalability: For large sets (kk8M), the reduction in hash structure size enables the kk9-PHF (with kk0 corresponding to cache line size) to remain cache-resident beyond the point where kk1 PHFs cease to fit, resulting in up to kk2 faster queries for negative and mixed queries across multiple CPU architectures.

Figure 3

Figure 4: Query throughput and space usage of the kk3-PHF compared to best-in-class baselines as kk4 increases.

Figure 5

Figure 1: 1- and 12-thread throughput for non-prefetched and prefetched static hash set queries on an Intel Skylake CPU.

Figure 6

Figure 3: 1- and 128-thread throughput for hash set queries on Intel Xeon CPU; benefits of kk5-PHF scale to high thread counts.

Figure 7

Figure 5: Effect of scaling threads (1 vs. 192) on query throughput for static hash sets on an AMD EPYC CPU.

Implications and Future Work

On the theoretical front, these tight lower bounds provide a comprehensive framework for analyzing new static hashing schemes and yield benchmarks that any practical algorithm must approach to be considered optimal with respect to space.

Practically, the kk6-PHF construction enables creation of static hash sets that are both highly space- and query-efficient, especially in read-heavy and negative-query-dominated applications (e.g., sequencing read classification, k-mer indexing, large-scale lookup tasks). The findings directly enable engineering of hash sets that remain fast at previously-intractable scales, and branchless/SIMD query routines further enhance real-world utility.

Possible directions for future research include the design of kk7-PHF schemes minimizing construction time under parallel, distributed, or external memory models; amortizing preprocessing cost across multiple related key sets; and extending the probabilistic and combinatorial analysis to schemes with variable bin sizes or even more flexible capacity constraints. Given the rapidly growing deployments of static hashing in AI and genomics pipelines, further empirical study to tailor kk8 and kk9 to hardware cache architectures and application access patterns appears warranted.

Conclusion

This work closes longstanding gaps in the theory and practice of non-minimal α\alpha0-perfect hashing, providing both tight space lower bounds for all α\alpha1 and load factors and a new class of practical α\alpha2-PHFs that are competitive to the lower bound and deliver cache-efficient, high-throughput static hash sets. The results have immediate applicability for practitioners seeking scalable, performant, and memory-efficient static set representations in settings where query throughput is paramount.

Paper to Video (Beta)

No one has generated a video about this paper yet.

Whiteboard

No one has generated a whiteboard explanation for this paper yet.

Open Problems

We haven't generated a list of open problems mentioned in this paper yet.

Tweets

Sign up for free to view the 1 tweet with 2 likes about this paper.