Performance of 3rd Party Content

Last month Jesse Robbins and I co-hosted the Velocity Summit. For the last three years we’ve gathered 30-40 industry gurus in the area of web performance and operations to help identify important topics to highlight at Velocity.

One session at this year’s Velocity Summit was called “Performance for the Masses.” It was led by Pat Meenan of WebPagetest.org fame. The discussion focused on the question “what improvements can we make in the world of web performance that will have a big impact for a lot of people?” The performance problems of ads came up, and everyone in the room got pretty excited. I might even say incensed.

From the beginning of my work in web performance back in 2004, web site owners have cited ads as the cause of web sites being slow. Embedding third party content in a web page is a performance challenge. In the best of situations, it’ll have some performance impact. In the worst of situations, third party content can make your page unusable. JavaScript errors, blocked rendering, HTTP timeouts, numerous resources, and just plain huge files can prevent users from seeing the main content of your page.

The problem of third party content is even more complicated for today’s web sites. In addition to ads, there are also widgets and analytics. I had a concall last month with Mashable to talk about performance. Their page has 40+ widgets including TweetMeme, Facebook, and Digg. Talk about a performance challenge! In the world of analytics the biggie is Google Analytics. That’s why I was so psyched to see them release their async snippet. Loading the GA code asynchronously reduces its impact on the main page’s performance.

During the Velocity Summit discussion, Alex Russell (Dojo, ChromeFrame) suggested creating a new tag that could wrap 3rd party code snippets and make them perform better. Alex called this the FRAG tag since it would be like creating a document fragment. The biggest performance gain this tag would support is asynchronous document.write. Many (most?) 3rd party snippets use document.write to modify the main page, which blocks the page from rendering and downloading further resources. Figuring out a way that the browser could continue to load the main page in parallel with 3rd party content containing document.write would be a big win. Jonas Sicking (Firefox), Alex, and I have had some follow-up discussion. We’ve also been looking at the proposed changes to IFRAME for HTML5, including the seamless and sandbox attributes. This might be a possible path, although we’d have to figure out how to make it degrade gracefully in older browsers, something a new tag would do nicely.

To help ground the discussion and make sure any proposal solves what’s wrong, I promised to review a dozen or so examples of popular ads, widgets, and analytics. Over the next month I’ll publish a series of posts that looks at specific code snippets. Some that I’m thinking about: Google AdSense, TweetMeme, Facebook Sharer, Digg, Meebo, Google Analytics, and Quantcast. Let me know what other popular 3rd party content snippets you think I should look at.

OK. Time to go look at snippets…