I’m incredibly excited to announce that I’ll be giving a talk at RustWeek 2026! On May 20, I’ll talk about phonebook, my attempt to build the fastest identifier interner possible. My goal is to explain my process of optimization, particularly at a low level, and to show how fun it can be. I hope to give you the tools, knowledge, and inspiration to try optimizing your own projects in the same way.
Here’s a basic outline of the talk (at this moment):
-
I’ll talk about the context of the problem I’m trying to solve (parsing files in parallel for my very-very-WIP Rust compiler, Krabby). This gives us a quantitative goal, and crucially, a data set for benchmarking.
-
Identifier interning is not a new problem, and there are existing solutions for it. I’ll go through some of them and evaluate their performance – even in languages other than Rust.
-
I’ll use one of those solutions (
string-interner) as a base and explain how it works (including the underlying hash table,hashbrown). Then, I’ll profile it, get some flamegraphs, and identify hot and cold paths. -
I’ll point out hot paths where the CPU is processing one byte or one element at a time. I’ll talk about vectorization, use it to optimize these paths, and explain why the compiler couldn’t do it for us.
-
For this problem, memory access is key to performance. It’s a complicated topic, so I’ll spend some time explaining how memory lookups work on modern CPUs, and how it relates to identifier interning. I’ll talk about different hash table designs, and write my own hash table with better memory access characteristics (for this use case).
-
I’ll identify a branch prediction problem within the interner – the same problem that hinders
memcpy(). Using my data set, I’ll analyze probability trees and optimize the branching structure of the code. -
At each step, there are many micro-optimizations that incrementally improve performance. I’ll show some examples where I rewrote half the code to save a single instruction.
-
I’ll describe the overall performance and API of
phonebook, and conclude by talking about the costs and benefits of obsessive optimization.
I’m still working on the code – I’m exploring more optimizations, and I want to perfect the library so I don’t have to expend more effort later. The code is available on Codeberg (and in particular on the cursed branch), but I’m in the middle of several rewrites.
If you’re interested, the talk is on May 20, at the Main Track. If you can see it in person, you should get a ticket! There will also be a livestream. If this topic interests you, feel free to send me an e-mail or talk to me at the conference!