This article is more than 1 year old

Google to relieve AdSense webpage drag

Scripts a future free from browser hang

Velocity Google has admitted that its AdSense text ads can account for 12 per cent of a webpage's load time, but the company is testing a revamped script designed to minimize the amount of time Google ads spend blocking pages.

Speaking this morning at the internet-infrastructure obsessed Velocity conference in Santa Clara, California, Google mathematician Michael Kleber said the company has been testing its iframe script for about a week on live sites. Crucially, the new script does not require website publishers to change their AdSense code.

"We want to minimize the amount of time we spend blocking the publisher page," Kleber said. "We want a webpage to be as fast with ads in it as without. But we want to do it without having publishers recast. We want to do it without them changing anything on their page, because, you know, AdSense is on millions of websites, and there's no way we're going to get millions to changes their pages.

"We want to have this work by default and not just for elite webmasters that keep up with best practices."

The company's solution is to replace the existing 40K-ish "show ads" AdSense JavaScript (show_ads.js) with a tiny loader script that creates an inline frame on the publisher's webpage. The rest of the script executes within that iframe, separately from the page itself.

With the old "show ads" setup, when the page downloads the script, all sorts of other tasks stop as the browser works to execute the code. But with the iframe setup, Google can access the same code path without causing the same stoppage.

"The remarkable thing is that it works and it's very fast," Kleber said. "Even though the script running inside the publisher page doesn't lock the publisher page from doing all the other things it wants to do, we still execute as quickly as possible, right on top of the stack."

According to Kleber, the median time that the old show ads script spent blocking the page was 47ms, and in the 90th per centile, this figure jumped to 288ms. With the new iframe script, the median figure drops to 11ms and in the 90th per centile the number dips to 32ms.

Kleber said there are still some problems with the setup, related to disparate setups among the various browsers. With Internet Explorer, for instance, some ads may be blocked when multiple iframe scripts are loaded at the same time. There are also issues related to using browser forward and back buttons. Sometimes, when you return to the page, the script will use the ads already there rather than re-fetching.

But Kleber hopes to roll out the new setup to more AdSense sites "in the very near future." Yes, there are similar problems with other Google services, including Google's DoubleClick ads and Google Analytics. But Kleber said that these don't slow webpages nearly as much as AdSense.

Google Analytics, he said, accounts for about 5 per cent of a webpage's load time. And with the new asynchronous Google Analytics snippet, he added, this figure should drop. ®

More about

TIP US OFF

Send us news


Other stories you might like