P99 0 ms* autocomplete for 240M domain names
dbalatero
46 points
22 comments
August 31, 2026
Related Discussions
Found 5 related stories in 71.6ms across 4,990 title embeddings via pgvector HNSW
- Typing Speed Test, but for Developers hronecviktor · 93 pts · July 18, 2026 · 45% similar
- Clever hacker fits 537,000 domains in a $5 ESP32 ad-blocking dongle sbulaev · 82 pts · July 19, 2026 · 45% similar
- Saving 100 terabytes of memory by optimizing 1.1.1.1's DNS cache TangerineDream · 644 pts · August 27, 2026 · 44% similar
- I built a 500k-domain search engine for makers in a weekend for $10 dreamforever · 139 pts · August 13, 2026 · 44% similar
- How Unix spell ran in 64 kB of RAM (2025) donw · 73 pts · July 27, 2026 · 43% similar
Discussion Highlights (11 comments)
camel_gopher
Clever but that’s not how we measure latency.
ViscountPenguin
Unfortunately this approach doesn't feel that great down here in Australia, definitely a function of latency. I think you could get a lot closer by framing this as an optimization problem, where you use the full alphabet dictionary, but add a residual prediction which aims to cover as much of the remaining domain name tree as possible weighted by popularity . This tree could then be pre-baked and stored with the same system. This would probably get you p99 0ms even in Australia.
pupppet
Autocomplete aside, this is a pretty nifty tool.
cortesoft
KeyDown events don’t work great for mobile, though.
ChannelFence
its pretty clever but what happns when someone pastes a domain or uses IME or voice input? the api being that fast is still impressive.
bagels
Looks more like 500ms?
pixelpoet
Pretty sure we mean < 1ms rather than actually instantaneous.
kevmo314
If you’d like to reduce the network latency further you can store each trie node as a file, naming it conveniently the prefix path to that node. Then dump the few hundred million files onto R2. Now the traversal can be done completely via CDN lookups!
skybrian
This autocomplete suggests domains that don't exist. You can just type garbage and it will suggest something, but then if you go there, there are no records. It seems like one purpose of an autocomplete box is help you avoid typos, so that makes it less useful.
chrismorgan
Using keyup makes no sense and is inconsistent with user expectations. For triggering actions (which includes normal typing), you only ever use keydown. (Well, there’s one exception for reasons unclear to me: activating a button by pressing Space. That triggers on keyup like how clicks are on release, while Enter triggers on keydown.) Keyup is limited to things where you’re constantly reacting to the state of a key, as is common in games. This affects the functionality, too. It is in fact introducing latency by using keyup instead of keydown. Feels bad.
oersted
Why not just trigger the fetch on keyDown and show it as soon as the response arrives, as usual? The time it takes to press a key is a reasonable target to aim at for API latency I suppose, but it is still an arbitrary target. Waiting to display until keyUp just adds more latency if your API is faster. Having it synced with keyUp doesn't make it feel more immediate to me.