HeadlinesBriefing favicon HeadlinesBriefing.com

p99 0 ms Autocomplete for 240M Domain Names

Hacker News •
×

I run Wirewiki.com, a site 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.

I've mostly achieved that. On key Down (the user starts pressing a key), we prefetch the suggestions for the typed character + any next character. And on key Up (the user releases the key), we render the suggestions.

That gives us a time budget of key Press1Duration + gap between key presses + key Press2Duration. 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.) Key released Key pressed wik GET /autocomplete?q=wi Render completions for ‘wik’ Time budget of the API API round-trip time The request for q=wi fires the instant i is pressed; if its response lands before k is released, completions for wik render with zero perceived latency.

So for the purpose of this article, we'll define latency as key Up 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. We need two things to make this happen: Client side prefetching and caching of the suggestions, and An API that's fast enough. How big is the budget? We now know that we can spend two key press durations and a gap duration, but how long is that in milliseconds? I've measured it while typing 100 domain names reasonably fast and found that p99 works out to 121 ms for me.