Google +1 Button Performance Review
aaronpeters.nl
Google +1 Button Performance Review
1–10 of 29 posts
Re: Google +1 Button Performance Review
#2
(function(d, t, g, s){
g = d.createElement(t),
s = d.getElementsByTagName(t)[0];
g.async = true;
g.src = 'https://apis.google.com/js/plusone.js';
s.parentNode.insertBefore(g, s);
})(document, 'script');
Load it as far up your page as possible, as to benefit from the parallelism early on and not hanging it off the end of or extending your page load.Re: Google +1 Button Performance Review
#3Re: Google +1 Button Performance Review
#4Google is evangelising performance on one hand and making careless errors on the other...
Re: Google +1 Button Performance Review
#5Someone at Google should get a slap upside the head for not getting this spot on. Google is evangelising performance on one hand and making careless errors on the other...
()
Re: Google +1 Button Performance Review
#6Someone at Google should get a slap upside the head for not getting this spot on. Google is evangelising performance on one hand and making careless errors on the other...
Yeah, how dare they say the lowest-performing option first in an in-passing comment! What if the user knows nothing about performance and stops there! Their page will load 8 milliseconds less quickly! Amateur hour!11! ( )
Re: Google +1 Button Performance Review
#7Re: Google +1 Button Performance Review
#8Google has added the +1 option to all their search requests / results, I'm sure if the performance was such an issue they would of found a way to fix it as it would degrade their page load times, granted I'm sure it's not the same 'exact' code.
Re: Google +1 Button Performance Review
#9In short, and as a rule with all scripts, load scripts asynchronously / non-blocking when possible, including Google +1. (function(d, t, g, s){ g = d.createElement(t), s = d.getElementsByTagName(t)[0]; g.async = true; g.src = 'https://apis.google.com/js/plusone.js'; s.parentNode.insertBefore(g, s); })(document, 'script'); Load it as far up your page as possible, as to benefit from the parallelism early on and not han…
- Define g and s as parameter even though they're only given a value inside the function
- Pass document into the function instead of using it from global scope
- Insert a script tag in front of the other script tags on-the-fly using insertBefore, instead of simply doing ...
Pretty interesting. Care to explain a bit?
Re: Google +1 Button Performance Review
#10There's another performance review of +1 here [3], which compares it to the Facebook Like button. Steve Souders (who's written books on web performance) has detailed and compared a few other 3rd party JavaScript buttons and widgets here [4].
[1] http://adage.com/article/digital/google-adds-button-foray-so...
[2] http://googlewebmastercentral.blogspot.com/2010/04/using-sit...
[3] http://www.artzstudio.com/2011/06/googles-button-is-slow-and...