ELSEIF
Your brief EB
448 stories from 199 feeds 1252 clusters Refreshed 27 minutes ago next pull 17:41

PERFORMANCE Signal 142

Autocomplete for 240M domains hits p99 0 ms via keyDown prefetch

Illustration only Photo by Veri Ivanova on Unsplash

Wirewiki's autocomplete for 240M domain names achieves p99 0 ms latency by prefetching suggestions on keyDown and rendering on keyUp.

WHY IT MATTERS

For engineers building search or autocomplete, this shows a practical way to hide API latency by using the time between key presses. The approach combines an in-memory trie for popular domains with a memory-mapped block index for the long tail, keeping the API fast enough to return before the user releases the key.

Written by elseif from the cluster below · every claim links back to a source

The three things worth knowing

01

The autocomplete prefetches suggestions for the typed character plus any next character on keyDown, then renders on keyUp.

02

The API uses an in-memory character trie for the top 1M domains and a memory-mapped block index for the remaining 240M domains.

03

The p99 latency budget is 121 ms, measured from key press to next release, and the API returns within that window for 99% of keystrokes.

THE READ

What the cluster adds up to.

ORIGINAL ANALYSIS

The autocomplete for Wirewiki now achieves p99 0 ms perceived latency by prefetching on keyDown and rendering on keyUp. This client-side technique hides API latency by using the time between key presses. The API is designed to be fast enough to return within that window, which is measured at 121 ms for p99 typing speed.

The API design splits the data into a head and a tail. The head is an in-memory character trie that stores the top 8 suggestions for every prefix, giving O(length) lookup. The tail is a memory-mapped block index with delta-compressed blocks, using a 27 MB directory for binary search and a linear scan of a 256-name block. The 240M domains take about 2.5 GB of disk space.

Adopting this approach costs significant memory and disk: the trie for the top 1M domains plus the block index for the full set. Data sources are limited to the Tranco top 1M and CZDS for gTLDs, so ccTLDs are not covered unless they have meaningful traffic. Results are returned in rank order, so the first 8 are the most popular, which may not match user intent for less common queries.

The technique stops working when the user types faster than the prefetch window or when the next character is not prefetched. The 121 ms budget is based on a specific typing pattern; slower or faster typists will see different behavior. On mobile or with non-standard input methods, the keyDown-to-keyUp gap may be shorter, reducing the effective budget. The p99 0 ms claim is specific to the measured conditions and may not hold universally.

Written by elseif from the cluster below · checked for specifics the sources never contained

THE CLUSTER

Same story, 1 feed.

ORDERED BY FIRST SEEN
ruurtjan.com via Hacker News P99 0 ms* autocomplete for 240M domain names Open ↗