Mar 17, 2011 17:24 GMT  ·  By

Making the web fast is becoming less a matter of network speeds or even browser performance, optimizing the websites themselves provides the best results most of the times. Google is obsessed with speed, but this obsession is a good thing, it means that its websites are light and load fast.

But there's always more to be done, Google has started rolling out an updated AdSense script which should dramatically improve the performance of any site that uses the ad network by enabling it to load its content without the ad script getting in the way.

Essentially, the new script allows the different resources on the site to load asynchronously.

"Over the past few days we’ve been rolling out a new and improved version of show_ads.js, the piece of JavaScript used by more than two million publishers to put AdSense advertisements on their web pages," Michael Kleber from the Ads Latency Team at Google announced.

"The new show_ads is small and fast, built so that your browser can turn its attention back to its main task — working on the rest of the web page — as soon as possible," he explained.

Many of the components of a web page load one at a time. This makes sense in some cases, but less so for off-site scripts. While the AdSense JavaScript snippet did its thing, it held up the loading of other components of the web page.

Now, by employing a clever trick, the new script allows all resources to load as they would normally while it does its job in parallel. Google does this by using what it calls a "friendly" iframe.

Iframes are basically web pages that load inside other web pages. They don't have the best reputation and for good reasons, they can pose a security risk, most of the times they look ugly and also create a number of more technical problems.

However, Google AdSense's iframes come from the same domain, hence the "friendly" tag, and many of the issues are averted.

Publishers and webmasters don't have to change anything. The regular AdSense script is still called, but it has been replaced by a much smaller loader script. This simply generates the iframe and then creates another script tag inside it.

In the meantime, the other components of the page can continue to load. However, and this is the part that actually saves time, while the other components load, the main AdSense script is being parsed and executed as well.

If you're interested in the technical details, you can check out the presentation in the video below.

This approach means that publishers don't have to update anything and automatically benefit from the changes. In testing, Google has found that the new AdSense script creates no more slowdowns whatsoever, the websites load with it as fast as they would without it.

However, there is a caveat, generating dynamically-populated friendly iframes doesn't work properly all the time in all browsers. So, for now, the new AdSense script works only in Chrome, Firefox and Internet Explorer 8. Support for other browsers is in the works. Also, you can disable the iframe feature if it creates problems with your site.