We use cookies

We use cookies to ensure you get the best experience on our website. For more information on how we use cookies, please see our cookie policy.

Back to home

Modern Perfect Hashing

Source

Hacker News

Published

TL;DR

AI Generated

The article discusses modern perfect hashing for strings, aiming to map a set of known strings to predefined integers efficiently. The author shares their implementation insights, focusing on optimizing the process for a fixed set of strings. They explore techniques like PEXT and magic values to achieve collision-free mapping. The article delves into code examples for different string lengths and explains the process of finding optimal magic values. The author highlights the importance of efficient splits and the trade-offs between speed and code size. Ultimately, the author achieved a runtime twice as fast as gperf with half the code size, emphasizing the need for a more modern approach in perfect hashing techniques.