Long delays with Facebook Like, Twitter, Adsense

I use AddThis on my site which includes the Facebook Like button and Twitter button. I also run Adsense.

Every time I run the speed test, these scripts are dramatically slowing down the load time. Each of them takes at least 6 seconds, sometimes over 20!! The DNS/TTFB are fine but the “Content Download” is what’s taking the time.

But I don’t get anywhere close to that when I load pages myself, even on an old computer using IE, with a cleared cache. Why is there such a big delay for WebPageTest?

Do you have a link to some test results to share?

Here is one example: http://www.webpagetest.org/result/110729_ZD_16775/1/details/

You’ve got a SERIOUS CPU utilization problem with the Javascript on that page. I re-ran the test with Dynatrace to get a javascript profile trace here: http://www.webpagetest.org/result/110802_H0_ce01f4e90dba82b8528937e35144ab75/

From what I can tell, it looks like you are dynamically adding the table to the DOM through Javascript - it looks like however that is being done took a solid 13 seconds in IE8, locking up the main thread and preventing anything else from happening.

How do you view the profile trace? The download on that page appears to be a zip file containing some binary files.

The table is in the page source, it’s not generated on the fly. But I do use DataTables to sort the table, which may slow down the page a little. But why would that make it say the Facebook like button takes 20+ seconds to download?

The top logo takes you to the download page for Dynatrace Ajax Edition which is a great (free) javascript profiler for IE (and Firefox).

The Facebook like button just had the unfortunate luck to be downloading when the main browser thread locked up for 20+ seconds executing javascript (single-threaded nature of browsers, they don’t do ANYTHING else when executing Javascript).

That’s weird because it always seems to be the Facebook button, never a file from my site… well I’ll keep looking into it and see if I can improve the performance.