Why loading third party scripts async is not good enough
aaronpeters.nl
aaronpeters.nl
This is a pet peeve of mine. Percentage changes should be measured using the original value as the denominator, not the new value.
So: 100 * (1.14 )/((1.14 + 3.63)/2) or -104%
If you want to overstate a change, you'll use the smaller value as the denominator. If you want to understate a change, you'll use the larger. If you use the mean of the two, you're giving a value that's not biased by either of the two extremes.
There are arguments for using other methods. As usual, Wikipedia has a good discussion of alternatives: http://en.wikipedia.org/wiki/Relative_change_and_difference
http://en.wikipedia.org/wiki/Relative_change_and_difference#...
"Conclusion: the loading, parsing and executing of the async third party scripts are quite often very slow and this messes up our End User performance stats in New Relic."
Delaying the dynamic insertion of scripts until after the onload event, doesn't change anything. All the external crap will still be loaded. It might even make the external assets load slower.
Another solution would be to choose a monitoring tool that distinguishes between DOMContentLoaded (or the equivalent in non-Gecko browsers) and the regular onload event.
https://developer.mozilla.org/en/Gecko-Specific_DOM_Events#D...
Without this code, the animation would wait until facebook, google + and twitter are all loaded, but with this code, the animation would start right away.
Here is a demonstration: http://ie.microsoft.com/testdrive/HTML5/DOMContentLoaded/Def...
> There was a problem loading Disqus. For more information, please visit status.disqus.com.
I wasn't able to comment because I'm on a slow connection, and the rest of the content hadn't finished loading by the time I had finished reading the article.
Isn't that a bit high? cdnplanet is actually impressively nippy for me, I'd just expect them to aim for 1.5 sec.
Now after deferring the 3rd party scripts, we know for sure what the user experience is with regards to the main content of the site.
All that aside, though I'd say I just changed my mind to agree with you.
http://www.olark.com/spw/2011/10/lightningjs-safe-fast-and-a...
...this technique begins downloads immediately, but still avoids blocking window.onload (just ran a brief test myself to verify this behavior). Unfortunately, it requires the third-party provider to adopt LightningJS. Here's to hoping that more providers take notice :)
"Always" seems like an unnecessarily high bar. If any meaningful fraction of your users would be better served by getting readable content in 2 seconds and having to wait 10-90 seconds for third-party features, I would absolutely say this is definitely a worthwhile optimization. Even if it leaves some speed-reading twitterer waiting the same 10-90 additional seconds for those features to load and render.