11 nanoseconds per word: Ridiculously Over-Optimizing Anagrams
A Rust optimization walkthrough reduces anagram-index construction on a particular in-memory Scrabble dictionary from 173 ns per word to roughly 11 ns per word. The author cuts allocations, packs letter counts, changes hash tables, and assigns primes to letters so each word’s product fits in 64 bits for that dictionary.
The collision-free prime-product claim depends on the tested word set and avoiding overflow; it is not a general guarantee for arbitrary inputs. The faster hash-table choice also assumes inputs aren’t adversarial.