Hacker News
P99 0 ms* autocomplete for 240M domain names
oersted
|next
[-]
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.
skybrian
|next
|previous
[-]
It seems like one purpose of an autocomplete box is help you avoid typos, so that makes it less useful.
chrismorgan
|next
|previous
[-]
This affects the functionality, too. It is in fact introducing latency by using keyup instead of keydown. Feels bad.
zxexz
|root
|parent
[-]
chrismorgan
|root
|parent
[-]
kevmo314
|next
|previous
[-]
Now the traversal can be done completely via CDN lookups!
ViscountPenguin
|next
|previous
[-]
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.