Hacker News new | ask | show | jobs
by jasode 2978 days ago
>Once you've loaded up the SPA once (ie. your 4 second delay), you are able to do multiple searches quite rapidly as the subsequent post requests are tiny

I don't think parent poster is talking about initial page load. Instead, the search page's javascript intercepts every keydown event so you would suffer 4 second round-trip delay for every keystroke. (You can go see this in browser's developer tools by setting a breakpoint on the keydown event.)

Instead of this:

  [4 seconds] page load done, type "Ruby"
It's this:

  R [4 seconds] u [4 seconds] b [4 seconds] y [4 seconds]
More examples of this keydown latency frustration are retail websites like homedepot.com and lowes.com. When you're at home on a fast fiber optic connection, the keydown events work fine. (Customers generally like the "autocomplete" feature that the keydown javascript code enables.) However, when I'm at the store with a mobile phone on a slow 3G connection, each keydown takes 5 seconds and it makes it impossible to use the website.
2 comments

Nah, the four seconds is just when it has no open connection. Provided there is an open connection (that is, you performed a search on that instance of the page in the last minute or so), searching is just one round trip away—sure, latency to Canada is a few hundred milliseconds, but you’re not going to get any faster than that without edge searching.
I don't think that's right, at least for algolia (maybe others are implemented badly):

- The latency for this query will never be 4 seconds (it's a tiny request/response, TLS connection is open already etc.)

- There's throttling applied so if you're typing it won't send the request until you've finished typing

- You don't have to wait for the previous response to come back to type another letter

Finally, the real time searching means you'll probably find what you're after faster as you don't have to complete the full word for it to appear.