arXivDaily arXiv每日学术速递 周一至周五更新
arXiv周末暂无论文更新,休息一下吧,周末愉快~~

非最小k完美哈希:紧密下界及在快速静态哈希表中的应用

Non-Minimal $k$-Perfect Hashing: Tight Lower Bounds and an Application to Fast Static Hash Tables

Ragnar Groot Koerkamp, Stefan Hermann, Peter Sanders, Stefan Walzer

arXiv 2607.07257首次发表:更新:

AI 中文总结

研究非最小k完美哈希,给出其在加速静态哈希表方面的应用。通过理论分析确定k - PHF紧密空间下界,实践中基于PtrHash开发并调优k - PHF用于静态哈希表,实现大小略超下界,在查询速度上有显著提升。

AI 中文摘要

最小完美哈希函数(minimal PHF)是将n个键的静态集映射到n个桶且无冲突的数据结构。两种自然推广是最小k - PHF(将n个键映射到n/k个容量为k的桶)和负载因子α < 1的(非最小)PHF(桶数量增加1/α倍,有空闲容量)。虽近期对完美哈希兴趣大增,但非最小k - PHF未被系统研究。其可加速静态哈希表,小缓存驻留k - PHF将每个键x映射到容量为k的缓存行大小桶。理论上确定了k - PHF在α ∈ (0,1]和k ≥ 1时的紧密空间下界,发现α < 1且k ≥ 2时空间大幅减少。实践中基于PtrHash开发k - PHF并用于静态哈希表,实现大小约比下界高50%,基于此的静态哈希集在负查询和混合查询中至少与其他哈希集一样快,在两种架构上对n ≥ 30M实现高达1.5倍加速。

英文摘要

A minimal perfect hash function (minimal PHF) is a data structure mapping a static set of $n$ keys to $n$ bins without collisions. Two natural generalizations are minimal $k$-PHFs where $n$ keys are mapped to $n/k$ bins of capacity $k$ 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 $k$-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 $k$-PHF maps each key $x$ to a cache-line-sized bin of capacity $k$ where $x$ 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 $k$-PHFs for all pairs of $α \in (0,1]$ and $k \geq 1$. It turns out that combining $α < 1$ and $k \geq 2$ drastically reduces the space of $k$-PHFs, e.g. for $(k,α) = (16,0.8)$ the space lower bound is $0.027$ bits per key while for $(k,α) = (16,1.0)$ and $(k,α) = (1,0.8)$ the lower bounds are higher by factors of $\approx 8$ and $\approx 32$, respectively. On the practical side, we develop a $k$-PHF based on PtrHash and tune it for use in static hash tables. Empirically, our implementation produces $k$-PHFs of size roughly $50\%$ above the lower bound. A static hash set based on this $k$-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\times$ speedup for large $n\geq 30M$ where a $1$-PHF does not fit in cache.

CommentsExtended version of ESA 2026 paper, including additional benchmarks in the appendix; 26 pages; 7 figures

DOI:10.4230/LIPIcs.ESA.2026.20

论文原文

arXiv 摘要页 · PDF 原文 · HTML 原文

↑