Tuesday, December 9, 2008

More better faster

So I finally sat down and got all the new dynamic table stuff ready. The technique that sped up the guild front page so much about a month ago has been applied to the character detail page as well as the run editor's log viewer.

So far it's brought the slowest loading page on the site down from 3.5 seconds (ouch!) to around 0.3 seconds. I think that's workable.

For those who are interested in this sort of thing: I have a small aversion to AJAX. When possible, I prefer to render things remotely: my tools are better, my debugging's better, all that sort of thing. I think this stood me in good stead when it came to the original version of AJAX (hardly anyone seems to use the XSLT variety anymore) and isn't a bad first instinct.

But when you have a page with multiple data tables that you want to paginate separately, you start having to do silly things to use remote rendering (said silly things mostly relating to out-of-band data for things like pagination), and the remote rendering starts taking a long time. Enter JSON. I wrote some javascript to populate a table from JSON data and we were off to the races. Most of the rendering is still done on the Swagbook server, but Swagbook now sends prettified components to the browser, which then assembles the table.

So what's the downside? Well, now javascript changes every time I want to change up a table - which doesn't happen as often as I'd thought it might. There's also an annoying "pop" as the page loads - this is from the second HTTP request for the JSON data. I'm considering eliminating the pop for some pages by stuffing the default data in the bottom of the page, but it's a bit low on the priority list right now.

No comments: