Aug. 18th, 2013
Question for the web-devs in the audience
Aug. 18th, 2013 11:10 pmSo, in order to capture the user's Timezone* I'm giving the user a dropdown with all of the allowed timezones. The new one has a popup for each possible output** - so that data is duplicated. And having checked, that's 18kB of options, repeated twice. 36000 characters of data being generated twice and then sent over the wire, every time a page is served.
This seems silly, as I don't actually expect people to pop up that combo box very often. Most of the time it's hidden invisibly in the background***
So, should I do something clever using JavaScript to fetch the list of allowed timezones when needed and then create the options on an ad-hoc basis? That risks slowing everything down for a second while it fetches the list over AJAX and then creates 600-odd entries, but shaves some time off the load. Or avoid doing this on the client in order to keep processing on the server where the majority of the page is generated, on the grounds that 36k is trivial by modern standards, and it's ok to waste that? Or add it into a separate JS file so that at least it's only loaded the once and then cached from then on****? Or something else?
Thoughts?
*For LJ/DW, which insists on having a time passed with each post, and mustn't have a time passed in before the current one - but takes that _in_ the user's local timezone, so I have to do the conversion before making the call. API here.
**i.e. LJ, DW, Wordpress, and any others I add later. Probably Tumblr, at the least.
***Iin the new version - clearly in the current one it's visible all the time.
****Which I only thought of at the end of writing this, and now seems most sensible. After all, they're loading jQuery whenever they hit my page, and that's 92k, and also cached.
This seems silly, as I don't actually expect people to pop up that combo box very often. Most of the time it's hidden invisibly in the background***
So, should I do something clever using JavaScript to fetch the list of allowed timezones when needed and then create the options on an ad-hoc basis? That risks slowing everything down for a second while it fetches the list over AJAX and then creates 600-odd entries, but shaves some time off the load. Or avoid doing this on the client in order to keep processing on the server where the majority of the page is generated, on the grounds that 36k is trivial by modern standards, and it's ok to waste that? Or add it into a separate JS file so that at least it's only loaded the once and then cached from then on****? Or something else?
Thoughts?
*For LJ/DW, which insists on having a time passed with each post, and mustn't have a time passed in before the current one - but takes that _in_ the user's local timezone, so I have to do the conversion before making the call. API here.
**i.e. LJ, DW, Wordpress, and any others I add later. Probably Tumblr, at the least.
***Iin the new version - clearly in the current one it's visible all the time.
****Which I only thought of at the end of writing this, and now seems most sensible. After all, they're loading jQuery whenever they hit my page, and that's 92k, and also cached.