5 ms·
P99 0 ms* autocomplete for 240M domain names
- pupppet 26d agoAutocomplete aside, this is a pretty nifty tool.
- AboozarEsmaili 26d ago[flagged]
- camel_gopher 26d agoClever but that’s not how we measure latency.
- dbalatero 26d agoWhen it comes to UX, perceived latency is king.
- wky 26d agoThe perceived latency starts from keydown, not keyup. Redefining latency to start at keyup reduces measured latency, not perceived latency, and delaying the visual display to keyup makes perceived latency strictly worse, not better. Even sticking with the keyup definition, just displaying the result as soon as it is available gives the possibility of negative (defined) latency.
- weird-eye-issue 26d agoI think you don't fully understand. They aren't just doing a search based on the key being pressed down. They already did a search based on the previous characters that returned results for all possible next characters. So by the time you type a second character it just checks results locally from the search that had likely already been returned from when you had typed the previous character.
- wky 26d agoThey do that, yet proceed to kneecap the perceived latency by delaying the render. > And on keyUp (the user releases the key), we render the suggestions.
- weird-eye-issue 26d agoThere are a large number of edge cases where rendering it on key down would not be desirable (user types Ctrl+v, how accented characters are enetered, how some Asian languages get handled, backspace/delete, user holds a key down, etc). This is getting into the point of optimization where it simply does not matter and can actually harm things
- wky 26d agoHolding a key would indeed require both on key down and up. I'd still argue that handling rerender on key down (or to fully match whatever OS/browser semantics, oninput) makes more sense than key up. Pressing Ctrl+V for example produces feedback as soon as "V" is pressed, not when Ctrl and/or V is released. Interestingly Ctrl+V on OP's website does update immediately when Ctrl+V is pressed.
- weird-eye-issue 26d agoWhy would you argue that makes more sense? That is not how any autocomplete works that I know of, it's not like this is a new pattern.
- Dylan16807 25d agoWhat autocompletes are you testing? I set my repeat delay to be very long so it doesn't interfere with the test, and then went to google and held down some keys for half a second. It types the letter and autocompletes long before I let go. Every UI I can find types the letter on keydown, and I don't know why you'd want typing and autocomplete to use different timings. Waiting for release is for mice and touch, not keyboards. And that's only because they have to deal with dragging.
- vasco 26d agoWhat you said might be true and yet what OPs AI agent did wasn't measure latency of the service nor calculated a p99 for it.
- deleted 26d ago[deleted]
- ViscountPenguin 26d agoUnfortunately 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.
- pul 26d agoInteresting, I didn't think of that yet. I think most people search for domains they own, which doesn't correlate with Tranco popularity ranking. Treating 'popularity' not as a function of visitors, but as a function of number of known domain names with that prefix could work, though.
- ViscountPenguin 25d agoFair enough, if people visit frequently you could probably save their previous searches as a cookie too.
- cortesoft 26d agoKeyDown events don’t work great for mobile, though.
- ChannelFence 26d agoits pretty clever but what happns when someone pastes a domain or uses IME or voice input? the api being that fast is still impressive.
- ltrg 26d agoOr uses swipe gestures on mobile keyboard!
- bagels 26d agoLooks more like 500ms?
- konsalexee 26d agoWhere did you get that?? Did you even read the post?
- bagels 24d agoI typed in a word, saw an obvious delay before the results were displayed. I also saw 500ms requests in the network tab. Yes, I read the post. A lot of words that were unnecessary in the face of a simple experiment.
- pixelpoet 26d agoPretty sure we mean < 1ms rather than actually instantaneous.
- lovich 26d agoIts like tic tacs saying they are 0 calories because they got the per serving size down low enough to round to 0.
- weird-eye-issue 26d agoOn a technical level yes but once you factor in monitor refresh rates then you can get to levels of optimization where it simply doesn't matter because you are constrained by waiting for the refresh rate anyways.
- kevmo314 26d agoIf 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!
- pul 26d agoCloudflare R2 doesn't distribute files globally. They only cache requested files in PoPs. So then it would function the same as an API behind the Cloudflare CDN.
- kevmo314 26d agoIt would skip the Cloudflare to server network hop that the author mentions being rather expensive for cache misses.
- pul 26d agoIt would replace the Cloudflare to server network hop with a cloudflare PoP to R2 hop. That covers approximately the same geographical distance and results in similar latency. (I'm the author btw)
- skybrian 26d agoThis 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.
- pierrefermat1 26d agoYes, OP seems to have completely lost touch with what is actually useful vs optimizing metrics for the sake of it.
- deleted 26d ago[deleted]
- lnenad 26d agoBut there is a cool blog post about it though.
- bawolff 26d agoThe autocomplete seemed to suggest real domains to me. If you typed in garbage it suggested the garbage plus a bunch of common TLDs - that seems like a reasonable choice to me. In any case, if your issue is the list of domains to suggest, its trivial to change that to a different list.
- addag 26d agoThis behavior seems to happen only when there is no more words in the list that can complete the current string. Otherwise, it shows only existing domains. I guess this behavior helps to autocomplete the domain extension for less-known domains that are not in the search list.
- Symbiote 26d agoIt doesn't work correctly with third level domains. speedtest.me.uk exists, but typing speedtest.me does not suggest it, and speedtest.me.u suggests speedtest.me.us first (doesn't exist). (.me.uk is a second level domain category in .uk, intended for personal domains.)
- chrismorgan 26d agoUsing 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.
- zxexz 26d agoAs a user, I’ve not thought too much about this before now. I agree with you mostly, but the keyup on space behaviour actually feels so innate I’d hate any change to it. Keydown on space is “jump”; nothing else.
- chrismorgan 26d agoI’d just like to hear an explanation of why it is. Because if you handled “is key currently pressed” events with polling rather than events (which is how people almost always consume them logically), it would be the only thing in the entire world that I can think of that would/should use keyup. Edit: I think people are misunderstanding me. I’m asking for an explanation of why, when you have a button focused, pressing Space activates on key up, rather than key down like literally everything else on the keyboard, including Enter on a focused button. (Mouse activates on release.)
- dangond 26d agoJump is keydown because many games let you adjust your jump height based on how long you hold down space after the jump starts.
- flaunf221 26d agoGames use keydown because it is more responsive and control responsiveness is vital to dynamic gameplay feeling good. There are some exceptions - if action can be charged, then it is on keydown. And then on gamepad sometimes actions are on release when developer has too many actions and not enough buttons, so it can be keyup vs hold.
- oersted 26d agoWhy 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.
- s4i 26d agoIt’s usually good to wait for user to do KeyUp before treating the string as final. A fellow commenter explained some of the reasons: https://news.ycombinator.com/item?id=49505993 https://news.ycombinator.com/item?id=49505993
- piterrro 26d agoI just typed a random sequence of the characters, long enough to be certain such domain doesnt exist. No only, the browser send an autocomplete request for every keystroke but for each request it returned a set of proposed domain names (which I'm 100% certain doesnt exist). At this point, how do I understand which results are legit and which are fake? Also, it would be nice to highlight the typed part in the result set so I can visually see what matches exactly.
- addag 26d agoFor the nonexisting domains, it seems like it only autocomplete with the possible domain extensions, (e.g .com, .org, ....) as the search list is non-exhaustive. But it could indeed be improved by not sending autocomplete requests anymore.
- pul 26d agoYou're not the first to mention this, so clearly users expect something different from what I've designed it for. I think I'll drop the TLD postfix suggestions.
- K0IN 26d ago[dead]
- Sarthakofficial 26d ago[flagged]
- deleted 26d ago[deleted]
- phil294 26d agoTangentially, I built something similar a few years back, at link-archive.org: https://web.archive.org/web/20220127233707/https://link-archive.org/ https://web.archive.org/web/20220127233707/https://link-arch... 3B existing URLs extracted from CommonCrawl, with instant search results. It was a fun project but didn't serve much real-world purpose besides curiosity and discovery. So I eventually ditched it, primarily because the link DB was a whopping 500 GiB in size, too much to just keep hosting. I just used SQLite FTS5 as the backend search engine. Just a few lines of code, but immediate response from a 0.5 TiB DB. SQLite is amazing.
- ape4 26d agoHow are the icons (for the domains) fetched so quickly?
- andai 26d ago>I've designed the API to first search Tranco (the head), and then CZDS (the tail) if necessary. How do you know if it's necessary? If Tranco returns less than eight?
- whalesalad 26d agoTranco is only top 1M domains.