On Nov 2, 10:45 am, maciej <
mceglow...@gmail.com> wrote:
> The issue with autocomplete is that right now it works by downloading
> a list of tags and doing completion locally in javascript. This is
> fine for a couple of hundred tags, but people with larger tag
> collections (in other words, nearly everyone on the site) would end up
> having to download a large JSON file of all their tags every time they
> wanted to add or edit something. I think this would add more suck
> than it subtracted.
>
> The right solution is to do tag completion on the server side, but
> this will require a fair amount of work and testing, so it may be a
> little while longer before I can make the change.
I thought Delicious does their completion client-side too (no time to
explore this now). I think with proper caching you're really not using
much bandwidth.
* Tag lists don't need to be super fresh, so repeated requests within,
I don't know, 6 hours or something, can just use their old copy and
transfer 0 bytes. (See Cache-Control.) What some folks do with
JavaScript and CSS and such is have the file never expire in the
cache, and change the URL when the file changes.
* Tag lists that don't change between requests can be truncated to
just HTTP headers. (See conditional GET and the Etag header.)
* Even when the tag list must be downloaded, JSON's real compact, and
it can be effectively gzipped.
* Probably unnecessary, but you could partition large tag lists across
several files so that only changed sections have to be downloaded.
Getting into really unnecessarily fancy territory, there could be 2
files: a stale tag list and fresh deltas.
Of course I don't have the stats on how big some of these tag lists
are, but a few KB of JSON once in a while seems pretty small compared
to the dynamically generated HTML Pinboard already serves. NB: server
side completion has lots of overhead and can't realistically benefit
from caching, so it's probably overkill until a tag list gets huge.
tl;dr - Cache-control and conditional GET should remove most of the
bandwidth associated with completion.