{"id":929,"date":"2009-02-10T17:51:37","date_gmt":"2009-02-10T22:51:37","guid":{"rendered":"http:\/\/alsplace.aldenbaker.com\/alsplace\/internet\/929\/how-to-make-your-website-really-really-fast\/"},"modified":"2009-02-10T17:52:24","modified_gmt":"2009-02-10T22:52:24","slug":"how-to-make-your-website-really-really-fast","status":"publish","type":"post","link":"http:\/\/alsplace.info\/?p=929","title":{"rendered":"How to make your website really, really fast"},"content":{"rendered":"\n<!-- ALL ADSENSE ADS DISABLED -->\n<h4 align=\"justify\">February 9th, 2009 <!-- by Andrew Mager --><\/h4>\n<p class=\"meta\" align=\"justify\">Posted by Andrew Mager<\/p>\n<p class=\"meta\" align=\"justify\"><a href=\"http:\/\/stevesouders.com\/\">Steve Souders<\/a> knows how to make a website speed through a web browser.<\/p>\n<p align=\"justify\"><a <a href=\"http:\/\/www.coastalrock.com\/\">cialis ejaculation<\/a>  href=&#8221;http:\/\/www.flickr.com\/photos\/mager\/3267072847\/&#8221; title=&#8221;Steve Souders from Google by magerleagues, on Flickr&#8221;><img decoding=\"async\" loading=\"lazy\" src=\"http:\/\/farm2.static.flickr.com\/1257\/3267072847_23f67af160.jpg\" border=\"0\" alt=\"Steve Souders from Google\" width=\"500\" height=\"375\" \/><\/a><\/p>\n<p align=\"justify\">And he works at <a href=\"http:\/\/www.google.com\/\">Google<\/a>, one of the fastest websites around.<\/p>\n<p align=\"justify\">Web performace is a two-pronged beast: efficiency and response time. Efficiency deals with the scalability challenges of building a top 100 global website. You have millions of users and billions of page views, and it&rsquo;s awe-inspiring to understand the full scope of the backend architecture of something that large.<\/p>\n<p align=\"justify\">The set of directions that the HTML document gives to every process really determines the speed of the page.<\/p>\n<p align=\"justify\">On <a href=\"http:\/\/www.google.com\/ig\">iGoogle<\/a> for example, only 17% of the page is backend, non-cached data and needs to be requested each time. The rest is front-end processing.<\/p>\n<p align=\"justify\">80-90% of the end-user response time is spent on the front-end. Start there when you want to figure out how you can make your site faster.<\/p>\n<p align=\"justify\">If you can cut this front-end time in half, your users will notice it.<br \/> Offer greater potential for improvement and notice simple performance tweaks on the backend too.<\/p>\n<h2 align=\"justify\">14 tips for performance<\/h2>\n<ol>\n<li>\n<div align=\"justify\">Make fewer HTTP requests<\/div>\n<\/li>\n<li>\n<div align=\"justify\">Use a CDN<\/div>\n<\/li>\n<li>\n<div align=\"justify\">Add an Expires header<\/div>\n<\/li>\n<li>\n<div align=\"justify\">Gzip components<\/div>\n<\/li>\n<li>\n<div align=\"justify\">Put stylesheets at the top<\/div>\n<\/li>\n<li>\n<div align=\"justify\">Put scripts at the bottom<\/div>\n<\/li>\n<li>\n<div align=\"justify\">Avoid CSS expressions<\/div>\n<\/li>\n<li>\n<div align=\"justify\">Make JS and CSS external<\/div>\n<\/li>\n<li>\n<div align=\"justify\">Reduce DNS lookups<\/div>\n<\/li>\n<li>\n<div align=\"justify\">Minify JS<\/div>\n<\/li>\n<li>\n<div align=\"justify\">Avoid redirects<\/div>\n<\/li>\n<li>\n<div align=\"justify\">Remove duplicate scripts<\/div>\n<\/li>\n<li>\n<div align=\"justify\">Configure <a href=\"http:\/\/en.wikipedia.org\/wiki\/HTTP_ETag\">ETags<\/a><\/div>\n<\/li>\n<li>\n<div align=\"justify\">Make AJAX cacheable<\/div>\n<\/li>\n<\/ol>\n<p align=\"justify\"><a href=\"http:\/\/developer.yahoo.com\/yslow\/\">YSlow<\/a> is a <a href=\"http:\/\/getfirebug.com\/\">Firebug<\/a> extension that gives developers the chance to analyze every slow part of your website and test it against the 14 points mentioned above.<\/p>\n<p align=\"justify\"><a href=\"http:\/\/en.oreilly.com\/velocity2009\">O&rsquo;Reilly Velocity<\/a> is a web performance and operations conference co-founded by Souders and Tim O&rsquo;Reilly. There should be some really good talks this year.<\/p>\n<p align=\"justify\">Souders also taught a class at Stanford called <a href=\"http:\/\/www.stanfordcourses.com\/CS193H\">High Performance Websites<\/a>.<\/p>\n<p align=\"justify\">Why focus on Javascript? They have a huge impact on the page load time.<\/p>\n<p align=\"justify\"><a href=\"http:\/\/www.flickr.com\/photos\/mager\/3267077089\/\" title=\"Time spent on the front end by magerleagues, on Flickr\"><img decoding=\"async\" loading=\"lazy\" src=\"http:\/\/farm2.static.flickr.com\/1037\/3267077089_04eb6e673b.jpg\" border=\"0\" alt=\"Time spent on the front end\" width=\"500\" height=\"375\" \/><\/a><\/p>\n<p align=\"justify\">AOL has about 5 scripts accounting for about 60 or 80% load time.<\/p>\n<p align=\"justify\"><a href=\"http:\/\/www.flickr.com\/photos\/mager\/3267904656\/\" title=\"Why focus on Javascript? by magerleagues, on Flickr\"><img decoding=\"async\" loading=\"lazy\" src=\"http:\/\/farm2.static.flickr.com\/1195\/3267904656_bda7312f4c.jpg\" border=\"0\" alt=\"Why focus on Javascript?\" width=\"500\" height=\"375\" \/><\/a><\/p>\n<p align=\"justify\">Facebook has about a megabyte of Javascript.<\/p>\n<p align=\"justify\"><a href=\"http:\/\/www.flickr.com\/photos\/mager\/3267904656\/\" title=\"Why focus on Javascript? by magerleagues, on Flickr\"><img decoding=\"async\" loading=\"lazy\" src=\"http:\/\/farm2.static.flickr.com\/1195\/3267904656_bda7312f4c.jpg\" border=\"0\" alt=\"Why focus on Javascript?\" width=\"500\" height=\"375\" \/><\/a><\/p>\n<p align=\"justify\">JS is downloaded sequentially, even if the HTML document has already been downloaded. It won&rsquo;t draw anything on the screen unless the script is finished downloading.<\/p>\n<p align=\"justify\"><a href=\"http:\/\/stevesouders.com\/cuzillion\/\">Cuzillion<\/a> is a tool that does batch testing on webpages.<\/p>\n<p align=\"justify\"><a href=\"http:\/\/www.flickr.com\/photos\/mager\/3267908250\/\" title=\"Cuzillion from Steve Souders by magerleagues, on Flickr\"><img decoding=\"async\" loading=\"lazy\" src=\"http:\/\/farm2.static.flickr.com\/1302\/3267908250_0fd25daacb.jpg\" border=\"0\" alt=\"Cuzillion from Steve Souders\" width=\"500\" height=\"375\" \/><\/a><\/p>\n<p align=\"justify\"><a href=\"http:\/\/www.httpwatch.com\/\">HTTPWatch<\/a> is his preferred packet sniffer.<\/p>\n<p align=\"justify\">If you can split the Javascript in what&rsquo;s needed to render and &ldquo;everything else&rdquo;, you will dramatically improve your page load time. Microsoft has a whitepaper that talks about how this can be done automatically with something called <a href=\"http:\/\/research.microsoft.com\/en-us\/projects\/doloto\/\">Doloto<\/a>. Look at the source code of MSN.com and see how they do it.<\/p>\n<p align=\"justify\"><a href=\"http:\/\/www.flickr.com\/photos\/mager\/3267088251\/\" title=\"Steve Souders from Google by magerleagues, on Flickr\"><img decoding=\"async\" loading=\"lazy\" src=\"http:\/\/farm2.static.flickr.com\/1390\/3267088251_9c13526911.jpg\" border=\"0\" alt=\"Steve Souders from Google\" width=\"500\" height=\"375\" \/><\/a><\/p>\n<p align=\"justify\">But even if you can split the initial page load, you will still have external scripts that will have an impact on your page.<\/p>\n<p align=\"justify\">There are many ways to make your scripts load all at the same time. XHR evaluation is an option but you are open to <a href=\"http:\/\/en.wikipedia.org\/wiki\/Cross-site_scripting\">XSS<\/a> attacks and all scripts must have the same domain.<\/p>\n<p align=\"justify\"><a href=\"http:\/\/www.flickr.com\/photos\/mager\/3267091795\/\" title=\"Fast websites by Steve Souders by magerleagues, on Flickr\"><img decoding=\"async\" loading=\"lazy\" src=\"http:\/\/farm2.static.flickr.com\/1018\/3267091795_f0c152b594.jpg\" border=\"0\" alt=\"Fast websites by Steve Souders\" width=\"500\" height=\"375\" \/><\/a><\/p>\n<p align=\"justify\">Putting a script in an iframe causes the JS to be downloaded in parallel with other resources on the page. You can use the DOM method for creating the head element using <a href=\"https:\/\/developer.mozilla.org\/en\/DOM\/document.createElement\">createElement<\/a>.<\/p>\n<p align=\"justify\">Try the &lt;script defer src=&quot;file.html&quot;&gt;. This works in IE and FF 3.1, but it&rsquo;s not the best method. Domains can differ and you don&rsquo;t have to refactor your code though.<\/p>\n<p align=\"justify\">Don&rsquo;t even use the document.write method. It&rsquo;s terrible for many reasons.<\/p>\n<p align=\"justify\">It&rsquo;s always good to show busy indicators when the user needs feedback. Lazy-loading code sucks, but the user needs to know that the page isn&rsquo;t done.<\/p>\n<p align=\"justify\">Ask yourself three questions:<\/p>\n<ul>\n<li>\n<div align=\"justify\">What&rsquo;s the URL of the script?<\/div>\n<\/li>\n<li>\n<div align=\"justify\">Do I want to trigger busy signals?<\/div>\n<\/li>\n<li>\n<div align=\"justify\">Does this script have to be executed in order or not?<\/div>\n<\/li>\n<\/ul>\n<p align=\"justify\"><a href=\"http:\/\/www.flickr.com\/photos\/mager\/3267095597\/\" title=\"Fast websites by Steve Souders by magerleagues, on Flickr\"><img decoding=\"async\" loading=\"lazy\" src=\"http:\/\/farm2.static.flickr.com\/1406\/3267095597_bfd462a77f.jpg\" border=\"0\" alt=\"Fast websites by Steve Souders\" width=\"500\" height=\"375\" \/><\/a><\/p>\n<p align=\"justify\">Sometimes the user is waiting for their inbox to load, and you need the scripts to load in order. Other times it won&rsquo;t matter.<\/p>\n<p align=\"justify\">The best part: none of these techniques are that hard to implement.<\/p>\n<p align=\"justify\">Don&rsquo;t let scripts block other downloads either.<\/p>\n<p align=\"justify\"><strong>Stylesheets load in parallel, but if you have a stylesheet followed by an inline script, parallel downloads are broken.<\/strong><\/p>\n<p align=\"justify\">Also, use link instead of @import.<\/p>\n<p align=\"justify\">Here is a link to Souders&rsquo; <a href=\"http:\/\/stevesouders.com\/ua\/\">UA profiler<\/a>. It&rsquo;s a chart of all the compatibilities among all browsers regarding fast loading pages. Or as Souders puts it, a &ldquo;community-driven project for gathering browser performance characteristics&rdquo;.<\/p>\n<p align=\"justify\">He also built something called <a href=\"http:\/\/stevesouders.com\/hammerhead\/\">Hammerhead<\/a>, which adds a little tab to Firebug that tells you the load time of the page. It also clears the cache in between load times. You can compare websites side by side too.<\/p>\n<p align=\"justify\">In HTTP 1.1 you can do transfer encoding in chunks. Your browser can un-gzip even a partial HTML document and start parsing it before the stylesheet is even loaded. CNET.com does this.<\/p>\n<p align=\"justify\">IE7 will open two connections per server name, unless the traffic is HTTP 1.0. Optimize images with <a href=\"http:\/\/smushit.com\/\">smush.it<\/a><\/p>\n<h2 align=\"justify\">Takeaways<\/h2>\n<p align=\"justify\">Focus is on the front end. Many front end engineers are learning on the job, kinda teaching themselves. It&rsquo;s an under-represented but a critical part of the web community.<\/p>\n<p align=\"justify\">Everything is going Javascript. It&rsquo;s the most painful thing to deal with on the page, and we need to identify and adopt some best practices in that space.<\/p>\n<p align=\"justify\">Speed matters. If you are waiting, you get bored and frustrated. When Google slowed down 500ms, they lost 20% traffic. Yahoo sped up their search results page only 400ms, and they got 5-10% faster. Amazon ties a 100ms latency to 1% sales loss. A faster page has an impact on revenue and cost savings.<\/p>\n<p align=\"justify\"><strong><a href=\"http:\/\/stevesouders.com\/docs\/cbs-20090209.ppt\">Here is a link to Steve&rsquo;s presentation &raquo;<\/a><\/strong><\/p>\n<p align=\"justify\">Souders wrote <em><a href=\"http:\/\/www.amazon.com\/High-Performance-Web-Sites-Essential\/dp\/0596529309\">High Performance Websites<\/a><\/em> in 2007.<\/p>\n<!-- Social Bookmarks BEGIN -->\n<div class=\"social_bookmark\">\n<a title=\"Click me to see the sites.\" href=\"#\" onclick=\"$$('div.d929').each( function(e) { e.visualEffect('slide_down',{duration:2.5}) }); return false;\"><strong><em>Bookmark to:<\/em><\/strong><\/a>\n<br \/>\n<div class=\"d929\" style=\"overflow:hidden\">\n<br \/>\n<br \/>\n<a style=\"font-size:90%;text-align: right; \" title=\"Click me to hide the sites.\" href=\"#\" onclick=\"$$('div.d929').each( function(e) { e.visualEffect('slide_up',{duration:0.5}) }); return false;\">Hide Sites<\/a>\n<\/div>\n<\/div>\n<!-- Social Bookmarks END -->\n<script type=\"text\/javascript\">$$('div.d929').each( function(e) { e.visualEffect('slide_up',{duration:0.5}) }); <\/script>","protected":false},"excerpt":{"rendered":"<p>February 9th, 2009 Posted by Andrew Mager Steve Souders knows how to make a website speed through a web browser. And he works at Google, one of the fastest websites around. Web performace is a two-pronged beast: efficiency and response time. Efficiency deals with the scalability challenges of building a top 100 global website. You [&hellip;]<\/p>\n<!-- Social Bookmarks BEGIN -->\n<div class=\"social_bookmark\">\n<a title=\"Click me to see the sites.\" href=\"#\" onclick=\"$$('div.d929').each( function(e) { e.visualEffect('slide_down',{duration:2.5}) }); return false;\"><strong><em>Bookmark to:<\/em><\/strong><\/a>\n<br \/>\n<div class=\"d929\" style=\"overflow:hidden\">\n<br \/>\n<br \/>\n<a style=\"font-size:90%;text-align: right; \" title=\"Click me to hide the sites.\" href=\"#\" onclick=\"$$('div.d929').each( function(e) { e.visualEffect('slide_up',{duration:0.5}) }); return false;\">Hide Sites<\/a>\n<\/div>\n<\/div>\n<!-- Social Bookmarks END -->\n<script type=\"text\/javascript\">$$('div.d929').each( function(e) { e.visualEffect('slide_up',{duration:0.5}) }); <\/script>","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[33,3,5],"tags":[],"_links":{"self":[{"href":"http:\/\/alsplace.info\/index.php?rest_route=\/wp\/v2\/posts\/929"}],"collection":[{"href":"http:\/\/alsplace.info\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/alsplace.info\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/alsplace.info\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"http:\/\/alsplace.info\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=929"}],"version-history":[{"count":0,"href":"http:\/\/alsplace.info\/index.php?rest_route=\/wp\/v2\/posts\/929\/revisions"}],"wp:attachment":[{"href":"http:\/\/alsplace.info\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=929"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/alsplace.info\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=929"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/alsplace.info\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=929"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}