Modern Perfect Hashing
Source
Published
TL;DR
AI GeneratedThe 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.