// HACKER NEWS — CYBERSECURITY
P99 0 ms* autocomplete for 240M domain names
I run Wirewiki.com, a website to inspect internet infrastructure like domain names. It helps people check (historic) DNS records,
DNS delegation, email deliverability config, etc.
There are a ton of sites that offer this (growing faster than ever thanks to vibe coding), so I need
a way to stand out. I picked tool quality / usefulness and UX.
The autocomplete is the main way to navigate Wirewiki, so it should be as complete, accurate and fast as possible.
I want it to be instant. Like, next frame instant.
On keyDown (the user starts pressing a key), we prefetch the suggestions for the typed character + any next character. And on keyUp (the user releases the key), we render the suggestions.
That gives us a time budget of keyPress1Duration + gap between key presses + keyPress2Duration. If the API returns before the end of the second key press, we'll have the results ready in time.
(A 60 Hz display renders every 16.7 ms. So we technically have 8.33 ms extra time budget at p50, but near 0 ms at p99.)
So for the purpose of this article, we'll define latency as keyUp to results ready for rendering. p99 0 ms means that 99% of the time, the results will be ready before the user even releases the key.
This was my concern initially. But it turns out not to be an issue. There are only 38 valid domain name characters: a-z, 0-9, - and .. That sets the upper limit of (38 + 1) * 8 = 312 domain names in the response.
In practice, that works out to a max of about 5 kB of data per request. 2.5 kB goes over the wire after compression.
Given that 50-100 kB is generally considered a healthy image size, an equivalent would be 20-40 characters typed.