A function $f : U \to \{0,\ldots,n-1\}$ is a minimal perfect hash function for a set $S \subseteq U$ of size $n$, if $f$ bijectively maps $S$ into the first $n$ natural numbers. These functions are important for many practical applications in computing, such as search engines, computer networks, and databases. Several algorithms have been proposed to build minimal perfect hash functions that: scale well to large sets, retain fast evaluation time, and take very little space, e.g., 2 - 3 bits/key. PTHash is one such algorithm, achieving very fast evaluation in compressed space, typically several times faster than other techniques. In this work, we propose a new construction algorithm for PTHash enabling: (1) multi-threading, to either build functions more quickly or more space-efficiently, and (2) external-memory processing to scale to inputs much larger than the available internal memory. Only few other algorithms in the literature share these features, despite of their big practical impact. We conduct an extensive experimental assessment on large real-world string collections and show that, with respect to other techniques, PTHash is competitive in construction time and space consumption, but retains 2 - 6$\times$ better lookup time.
翻译:函数$f : U \to \{0,\ldots,n-1\}$称为集合$S \subseteq U$(大小为$n$)的最小完美哈希函数,当且仅当$f$将$S$双射映射到前$n$个自然数。此类函数在搜索引擎、计算机网络和数据库等众多计算应用场景中具有重要价值。目前已提出多种构建最小完美哈希函数的算法,这些算法需满足:良好扩展至大规模集合、保持快速评估时间、占用极低空间(例如2-3比特/键)。PTHash是其中一种算法,能在压缩空间下实现极快评估速度,通常比其他技术快数倍。本研究提出一种新的PTHash构建算法,具备以下特性:(1)支持多线程,可更快或更节省空间地构建函数;(2)支持外存处理,可扩展至远超可用内存容量的输入规模。尽管这些特性具有重大实践意义,但文献中仅有少数其他算法具备类似功能。我们基于大规模真实字符串集合进行了广泛实验评估,结果表明:与其他技术相比,PTHash在构建时间和空间消耗方面具有竞争力,且查找时间仍保持2-6倍的提升。