The document discusses techniques for optimizing web page performance, including loading scripts asynchronously without blocking page rendering, splitting scripts into critical and non-critical parts, leveraging content delivery networks, minimizing downloads, and using new web standards like the Navigation Timing API. It emphasizes the importance of front-end optimization and progressive enhancement to improve site speed. Examples are given of how major sites like Google, Facebook, and Wikipedia optimize script loading.
1 of 56
More Related Content
Web Directions South - Even Faster Web Sites
1. Even Faster Web Sitesstevesouders.com/docs/wdx-20101014.pptxDisclaimer: This content does not necessarily reflect the opinions of my employer.flickr.com/photos/ddfic/722634166/
2. how exciting is web dev?flickr.com/photos/joshme17/1557627176/
14. Site speed in search rankScreen shot of blog postwe've decided to take site speed into account in our search rankings.googlewebmastercentral.blogspot.com/2010/04/using-site-speed-in-web-search-ranking.html
16. Bothcombine scriptscombine stylesheetsadd an Expires headergzip responsesput stylesheets at the topput scripts at the bottomavoid CSS expressionsmake JS and CSS externalreduce DNS lookupsminify JS and CSSavoid redirectsremove duplicate scriptsmake Ajax cacheablereduce cookie sizeuse cookie-free domainsdon't scale imagesYSlowuse CSS spritesuse a CDNconfigure ETagsuse GET for Ajax requestsreduce # of DOM elementsno 404savoid image filtersoptimize faviconPage Speeddefer loading JSremove unused CSSuse efficient CSS selectorsoptimize imagesoptimize order of CSS & JSshard domainsleverage proxy caching
33. split the initial payloadsplit your JavaScript between what's needed to render the page and everything elsedefer "everything else"split manually (Page Speed), automatically (Microsoft Doloto)load scripts without blockinghttp://www.flickr.com/photos/devcentre/108032900/
34. Loading Scripts Without BlockingXHR EvalXHR InjectionScript in IframeScript DOM ElementScript Deferdocument.write Script Tag
35. XHR EvalvarxhrObj = getXHRObject();xhrObj.onreadystatechange = function() { if ( xhrObj.readyState != 4 ) return;eval(xhrObj.responseText); };xhrObj.open('GET', 'A.js', true);xhrObj.send('');script & page must be same domain
36. Script DOM Elementvar se = document.createElement('script');se.src = /slideshow/web-directions-south-even-faster-web-sites/5495374/& script & page domains can differmay not preserve execution order
37. MeeboIframed JSvar iframe = document.createElement('iframe');document.body.appendChild(iframe);var doc = iframe.contentWindow.document;doc.open().write('<body onload="insertJS()">');doc.close();loads asynchronouslydelays parents load event: FF, Chr, Safgreat for 3rd party scriptsbetter for sandboxing & securityavoids iframe src roundtrip
38. GMail Mobile<script type="text/javascript">/*var ... */</script>get script DOM element's textremove commentseval() when invokedinline or iframeawesome for prefetching JS that might (not) be needed
60. W3C Web Timing Specwindow.[webkit|moz|ms]Performancetest.w3.org/webperf/specs/NavigationTiming/
61. speed mattersfocus on the frontendrun Page Speed and YSlowprogressive enhancement progressive renderingbe excited!takeawaysflickr.com/photos/34771728@N00/361526991/
Fred Wilson is Managing Partner of two venture capital firms, Flatiron Partners (Yoyodyne, Geocities) and Union Square Ventures (Twitter, delicious,Etsy, Feedburner).SpeedInstant utilitySoftware is mediaLess is moreMake it programmableMake it personalRESTfulDiscoverabilityCleanPlayful
if were able to achieve a similar performance boost across ourothertoplanding pages, well drive in excess of 60 million yearly Firefox downloads.
http://www.webpagetest.org/video/compare.php?tests=100607_SN,100607_SM,100607_SK,100607_SJ,100607_S6http://www.google.com/search?q=flowershttp://search.yahoo.com/search?p=flowershttp://www.bing.com/search?q=flowershttp://www.ask.com/web?q=flowershttp://search.aol.com/aol/search?q=flowersIE7, Dulles VA, DSL
All of these allow for parallel downloads, but none of them allow for parallel JS execution that's not possible (currently, WebKit is doing some stuff on that).