hashify v0.3: compile-time perfect hashing, now 4 to 12 times faster than phf
The Rust hashify procedural macro now chooses among a decision tree, a small seeded table, and a minimal perfect hash based on key-set size. Its generated lookups avoid runtime allocation and unsafe; the author reports 4–13× faster lookups than phf in the tested cases, with the biggest gains on larger keyword sets.
The design is specialized for keys known at compile time: the macro searches for seeds that fit the particular set, and large tables can add noticeable compile time. Reddit commenters also noted the benchmark measures throughput with independent probes, not dependent lookup latency; the author says a direct comparison against the standalone PtrHash implementation remains unmeasured. The discussion includes useful details on how range analysis removes bounds checks and why short keys use compact comparisons.