arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2602.05925cs.DS
收藏

自适应哈希:更快的哈希函数与更少的碰撞

Adaptive Hashing: Faster Hash Functions with Fewer Collisions

Google DeepMind(谷歌DeepMind)

Gábor Melis

AI总结:

本文提出了一种自适应哈希方法,通过在线调整哈希函数以减少碰撞并提高速度。

摘要:

哈希表无处不在,其性能在很大程度上取决于将键映射到桶的哈希函数的选择。我们认为,将哈希函数固定在整个哈希表生命周期内的主流方法是次优的,并提出将其适应于当前的键集。在主流观点中,好的哈希函数会将键

英文摘要:

Hash tables are ubiquitous, and the choice of hash function, which maps a key to a bucket, is key to their performance. We argue that the predominant approach of fixing the hash function for the lifetime of the hash table is suboptimal and propose adapting it to the current set of keys. In the prevailing view, good hash functions spread the keys ``randomly'' and are fast to evaluate. General-purpose ones (e.g. Murmur) are designed to do both while remaining agnostic to the distribution of the keys, which limits their bucketing ability and wastes computation. When these shortcomings are recognized, one may specify a hash function more tailored to some assumed key distribution, but doing so almost always introduces an unbounded risk in case this assumption does not bear out in practice. At the other, fully key-aware end of the spectrum, Perfect Hashing algorithms can discover hash functions to bucket a given set of keys optimally, but they are costly to run and require the keys to be known and fixed ahead of time. Our main conceptual contribution is that adapting the hash table's hash function to the keys online is necessary for the best performance, as adaptivity allows for better bucketing of keys \emph{and} faster hash functions. We instantiate the idea of online adaptation with minimal overhead and no change to the hash table API. The experiments show that the adaptive approach marries the common-case performance of weak hash functions with the robustness of general-purpose ones.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑