How not to optimize a site with AJAX

December 19th, 2008

I’ve inherited a project that is seeing some performance issues. We knew this was at least partly to blame on the UI, but most of the problem is down in the application. Fine; we’ve got a plan for the application-level issue and that’ll get solved. But right now, I’ve been picking through the UI because even though inspection with FireBug reveals that the site is loading at a reasonable clip, it doesn’t seem to be rendering the main page until every last linked resource is loaded in the browser.

As the subject of this post should indicate, this project features AJAX. AJAX isn’t exactly brand new, but this project represents the first aggressive use of AJAX in my particular custom-projects corner of the universe. And as far as I can tell, once the decision was made to “go AJAX!”, a side directive of “abandon sanity!” was also put in motion.

Here’s what’s great about AJAX: You load the static elements of your page once, and then you refresh the dynamic stuff with a behind-the-scenes request that leaves the static page elements unchanged. In other words, it makes a web page behave more like a locally installed application.

But let’s say you’ve just learned about AJAX and you want to GO the DISTANCE! Then, even though the static page elements should never change, maybe you dynamically request them, too! And then use JavaScript to discreetly rewrite the whole page! In your zero-latency development environment, the difference in rendering time may be completely undetectable.

Unfortunately, when half a planet’s worth of internet lies between you and the server, the effect is pretty different. Your AJAX request is an extra layer of abstraction that just linking static elements from the page itself will completely avoid. And, because the associated rendering may not be possible until after you’ve finished loading all of the AJAX-related JavaScript resources, you leave your users staring at the bare rafters of your web site until the loading is done.

Moral of the story: identify static page elements and keep them out of your AJAX scheme. If you really want to do the whole thing in AJAX, at least give the user a meaningful static site to look at while all of the background requests are churning. They might stay on your site long enough to see what you’ve cooked up..

SRSLY

November 16th, 2008

To web app developers everywhere: give up and use tables. You know what I’m talking about.

I am proud to be a part of this

November 4th, 2008

“I hold it, that a little rebellion, now and then, is a good thing, and as necessary in the political world as storms in the physical.” - Thomas Jefferson

Writing

August 25th, 2008

I’ve started writing again. I was excited to have actually committed words to paper (metaphorically), and was going to share them with you. But I was struck with another idea, something that’s harder than writing, but I’d like to try it. The challenge is this: to finish what I’ve started. I’m going to finish what I’m writing, and then I want to revise it, and then… I want to publish it. It’s going to take a while. Might take a year or two. But if you’ve read any of the ‘writing’ posts on my blog and liked what you read, then I think you will like what I have started working on.

But hey, for what it’s worth, I was this close to sharing a snippet with you. Maybe after I have a few chapters under my belt.

Books for Sale

July 20th, 2008

[Update: Books Sold. Thanks for your interest!]

Hey there–
With the advent of D&D 4e, it is time again for me to make some space on my gaming book shelf. The list below represents most of the added crunch you could pick up for D&D 3.5 and Star Wars (Revised), with a couple of third-party extras that date back to 3.0. Drop me a line if you are interested in any of these. Next week, anything left over goes to eBay.

Read the rest of this entry »