On 4/19/2014 7:19 PM, Aleksandar Ruzicic wrote:
On Saturday, 19 April 2014 at 23:06:55 UTC, Nick Sabalausky wrote:
On 4/19/2014 6:01 PM, Aleksandar Ruzicic wrote:
That can surely be stored in a Cookie, but I also prefer localStorage,
mostly for performance reasons (cookies get sent on *every* request,
unless you setup subdomain just for that type of cookies) and for the
fact that cookies are the worst thing ever happened to HTTP :)
Session cookies are a few **bytes** in size. Selection of
languages/frameworks would also be a mere handful of bytes. That's
completely dwarfed by just the HTTP headers alone.
There is *NO* performance issue here whatsoever unless you're on a
circa-1980's dial-up (in which case the cookie itself *still* isn't
going to be the main performance issue ;) )
Yes they are few bytes but they are sent for *every* request. That
includes every image, every css/js file..
When working on large scale you want to avoid any unnecessary headers,
not so much because of a client but because of a server.
Doesn't matter if you're talking server or client, it's still the same
miniscule proportion of the total. Even for the server to receive it for
every css/js file request, even if they *aren't* cached (and
realistically they will be), it's still a mere drop in the bucket.
Suppose if it were as much as 100 bytes, which would be fairly large for
a cookie (mine total around 50 bytes or less when sent to the server),
then even 1000 requests (considerably larger than a typical session,
unless it's being overly-AJAXy, which would be a bigger performance
drain for both server/client than cookies anyway) is *still* just 100kB
which, for a modern server and that many requests, is nothing. It's
still *completely* dwarfed by all the other crap in the client's headers
alone, let alone the actual payload data being transferred back which,
in most cases, will be considerably larger still.