SlideShare a Scribd company logo
1 of 66
fast by default http://stevesouders.com/docs/amazon-20091030.pptx Disclaimer: This content does not necessarily reflect the opinions of my employer.
GMail Mobile: http://googlecode.blogspot.com/2009/09/gmail-for-mobile-html5-series-reducing.html SproutCore: http://blog.sproutcore.com/post/225219087/faster-loading-through-eval Google, Bing biz metrics: http://en.oreilly.com/velocity2009/public/schedule/detail/8523  Yahoo! biz metrics: http://www.slideshare.net/stoyan/yslow-20-presentation Shopzilla biz metrics: http://en.oreilly.com/velocity2009/public/schedule/detail/7709 Netflix outbound traffic: http://en.oreilly.com/velocity2008/public/schedule/detail/3632 Google, Bing charts: http://www.watchingwebsites.com/archives/proof-that-speeding-up-websites-improves-online-business Aptimize WAX: http://blogs.msdn.com/sharepoint/archive/2009/09/28/how-we-did-it-speeding-up-sharepoint-microsoft-com.aspx Strangeloop Networks: http://www.watchingwebsites.com/archives/proof-that-speeding-up-websites-improves-online-business SproutCore: http://blog.sproutcore.com/post/196959232/how-sproutcore-makes-your-app-run-faster HTTP Archive Format: http://www.stevesouders.com/blog/2009/10/19/http-archive-specification-firebug-and-httpwatch/ @font-face: http://www.stevesouders.com/blog/2009/10/13/font-face-and-performance/
Happy Halloween!
17% 83% iGoogle, primed cache the importance of frontend performance 9% 91% iGoogle, empty cache
Make fewer HTTP requests Use a CDN Add an Expires header Gzip components Put stylesheets at the top Put scripts at the bottom Avoid CSS expressions Make JS and CSS external Reduce DNS lookups Minify JS Avoid redirects Remove duplicate scripts Configure ETags Make AJAX cacheable 14 Rules
Even Faster Web Sites Splitting the initial payload Loading scripts without blocking Coupling asynchronous scripts Positioning inline scripts Sharding dominant domains Flushing the document early Using iframes sparingly Simplifying CSS Selectors Understanding Ajax performance..........Doug Crockford Creating responsive web apps............Ben Galbraith, Dion Almaer Writing efficient JavaScript.............Nicholas Zakas Scaling with Comet.....................Dylan Schiemann Going beyond gzipping...............Tony Gentilcore Optimizing images...................Stoyan Stefanov, Nicole Sullivan
Yahoo! Wikipedia eBay AOL MySpace YouTube Facebook Why focus on JavaScript?
scripts block <script src="A.js"> blocks parallel downloads and rendering 9 secs: IE 6-7, FF 3.0, Chr 1, Op 9-10, Saf 3 7 secs: IE 8, FF 3.5, Chr3, Saf 4
26% avg 252K avg initial payload and execution
splitting the initial payload split your JavaScript between what's needed to render the page and everything else defer "everything else" split manually (Page Speed), automatically (Microsoft Doloto) load scripts without blocking – how?
MSN Scripts and other resources downloaded in parallel! How? Secret sauce?! var p= g.getElementsByTagName("HEAD")[0]; var c=g.createElement("script"); c.type="text/javascript"; c.onreadystatechange=n; c.onerror=c.onload=k; c.src=e; p.appendChild(c) MSN.com: parallel scripts
Loading Scripts Without Blocking XHR Eval XHR Injection Script in Iframe Script DOM Element Script Defer document.write Script Tag
XHR Eval varxhrObj = 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 massage script?
XHR Injection varxhrObj = getXHRObject(); xhrObj.onreadystatechange =    function() {      if ( xhrObj.readyState != 4 ) return; var se=document.createElement('script'); document.getElementsByTagName('head')         [0].appendChild(se); se.text = xhrObj.responseText;   }; xhrObj.open('GET', 'A.js', true); xhrObj.send(''); script must have same domain as main page
Script in Iframe <iframe src='A.html' width=0 height=0  frameborder=0 id=frame1></iframe>  iframe must have same domain as main page must refactor script: // access iframe from main page window.frames[0].createNewDiv(); // access main page from iframe parent.document.createElement('div');
Script DOM Element var se = document.createElement('script'); se.src = 'http://anydomain.com/A.js'; document.getElementsByTagName('head') [0].appendChild(se);  script & page domains can differ no need to massage JavaScript may not preserve execution order
GMail Mobile <script type="text/javascript"> /* var ...  */ </script> get script DOM element's text remove comments eval() when invoked inline or iframe awesome for prefetching JS that might (not) be needed
SproutCore var module1 = "..."; var module2 = "..."; eval() modules as needed 2nd fastest downloading 2nd fastest loading symbols best alternative
<script defer src='A.js'></script> supported in IE and FF 3.1+ script and main page domains can differ no need to refactor JavaScript Script Defer
document.write("<script type='text/javascript' src='A.js'> <script>"); parallelization only works in IE parallel downloads for scripts, nothing else all document.writes must be in same script block document.writeScript Tag
browser busy indicators
*Only other document.write scripts are downloaded in parallel (in the same script block). Load Scripts Without Blocking
XHR Eval XHR Injection Script in iframe Script DOM Element Script Defer same domains different domains Script DOM Element Script Defer preserve order no order XHR Eval XHR Injection Script in iframe Script DOM Element (IE) Script DOM Element (FF) Script Defer (IE) Managed XHR Eval Managed XHR Injection no order preserve order Script DOM Element show busy no busy Script DOM Element (FF) Script Defer (IE) Managed XHR Injection Managed XHR Eval Script DOM Element (FF) Script Defer (IE) Managed XHR Eval Managed XHR Injection no busy show busy XHR Injection XHR Eval Script DOM Element (IE) Managed XHR Injection Managed XHR Eval Script DOM Element and the winner is...
bad: stylesheet followed by inline script stylesheets load in parallel with other resources... ...unless followed by an inline script put inline JS above stylesheets or below other resources use Link, not @import
MSN Wikipedia eBay MySpace mispositioned inline scripts
<script type="text/javascript"> varamznJQ = {   _a: [], _s: [], _d: [], _l: [], _o: [], _c: [], _cs: [], addLogical: function() {  background-image: url(http://…/navPackedSprites_v12._V222883957_.png); <imgsrc="http://.../navPackedSprites_v12._V222883957_.png" style="display:none"/> var swmsMainContentImage_67691 =    '<imgsrc="http://.../wl10_marquee_wk4-kindlelove._V228858619_.png">'; <!--[if (gte IE 5.5)&(lt IE 7)]> <script type="text/javascript"> if (document.body.filters) {     swmsMainContentImage_67691 = '<img style="filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(en three script blocks between two script blocks between last resource onload
last resource onload deferred ads!
</style> <script type="text/javascript"> varamznJQ = {   _a: [], _s: [], _d: [], _l: [], _o: [], _c: [], _cs: [], addLogical: function() {  background-image: url(http://…/navPackedSprites_v12._V222883957_.png); <imgsrc="http://.../navPackedSprites_v12._V222883957_.png" style="display:none"/> last resource onload
var swmsMainContentImage_67691 =    '<imgsrc="http://.../wl10_marquee_wk4-kindlelove._V228858619_.png">'; <!--[if (gte IE 5.5)&(lt IE 7)]> <script type="text/javascript"> if (document.body.filters) {     swmsMainContentImage_67691 = '<img style="filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(en last resource onload
three script blocks between last resource onload
two script blocks between last resource onload
last resource loaded twice onload
reduce HTTP use a CDN add Expires gzip minify configure ETags
Google + 0.4 sec searches  0.6%
Yahoo! + 0.4 sec traffic  5-9%
Bing +2 sec revenue  4.3%
Shopzilla -5 sec revenue 12% hw50%
Netflix outbound bandwidth         43%
fast performance = better user experience more traffic more revenue reduced costs
so... why don't more people do it?
it's too hard!
"if it wasn't hard everyone would do it" "the hard is what makes it great"
this year's theme: Fast by Default
Aptimize WAX concatenate scripts concatenate stylesheets sprites, data: URIs far future Expires minify JS and CSS automatically in real time
WAX on: http://sharepoint.microsoft.com # requests empty: 96  35 # requests primed: 50  9 scripts 7, stylesheets 12, images 25 pages faster: 46-64% empty, 15-53% primed
Strangeloop Networks "typical ecommerce site" pages per visit: 11  16 time on site: 24  30 mins conversions: 16% order value: 5.5%
Rails far future Expires concatenate scripts domain sharding configure ETags in pipeline: async scripts, spriting, minification, flushing
SproutCore concatenate scripts concatenate stylesheets versioning (future Expires) stylesheets at the top scripts at the bottom minify JS & CSS remove dupe scripts
WPO
Why do some sites feel slow ?
Google Mail
Google Docs
AOL
Twitter
ESPN
Best Buy
IKEA
CNN
(lack of) Progressive Rendering
Search
WebPagetest.org VA, UK, NZ IE7, IE8 Dial, DSL, FIOS empty, empty & primed quad core Pat Meenan (AOL)
News

More Related Content

What's hot

How do speed up web pages? CSS & HTML Tricks
How do speed up web pages? CSS & HTML TricksHow do speed up web pages? CSS & HTML Tricks
How do speed up web pages? CSS & HTML Tricks
Compare Infobase Limited
 
Advanced SEO for Web Developers
Advanced SEO for Web DevelopersAdvanced SEO for Web Developers
Advanced SEO for Web Developers
Nathan Buggia
 
Doctype html
Doctype htmlDoctype html
Doctype html
Eddy_TKJ
 

What's hot (18)

Oscon 20080724
Oscon 20080724Oscon 20080724
Oscon 20080724
 
Getting More Traffic From Search Advanced Seo For Developers Presentation
Getting More Traffic From Search  Advanced Seo For Developers PresentationGetting More Traffic From Search  Advanced Seo For Developers Presentation
Getting More Traffic From Search Advanced Seo For Developers Presentation
 
BDD - Writing better scenario
BDD - Writing better scenarioBDD - Writing better scenario
BDD - Writing better scenario
 
How do speed up web pages? CSS & HTML Tricks
How do speed up web pages? CSS & HTML TricksHow do speed up web pages? CSS & HTML Tricks
How do speed up web pages? CSS & HTML Tricks
 
Enterprise AIR Development for JavaScript Developers
Enterprise AIR Development for JavaScript DevelopersEnterprise AIR Development for JavaScript Developers
Enterprise AIR Development for JavaScript Developers
 
Advanced SEO for Web Developers
Advanced SEO for Web DevelopersAdvanced SEO for Web Developers
Advanced SEO for Web Developers
 
WordPress Standardized Loop API
WordPress Standardized Loop APIWordPress Standardized Loop API
WordPress Standardized Loop API
 
Beautiful Java EE - PrettyFaces
Beautiful Java EE - PrettyFacesBeautiful Java EE - PrettyFaces
Beautiful Java EE - PrettyFaces
 
LinkedIn Platform at LeWeb 2010
LinkedIn Platform at LeWeb 2010LinkedIn Platform at LeWeb 2010
LinkedIn Platform at LeWeb 2010
 
Doctype html
Doctype htmlDoctype html
Doctype html
 
Plone Interactivity
Plone InteractivityPlone Interactivity
Plone Interactivity
 
Flash Templates- Joomla!Days NL 2009 #jd09nl
Flash Templates- Joomla!Days NL 2009 #jd09nlFlash Templates- Joomla!Days NL 2009 #jd09nl
Flash Templates- Joomla!Days NL 2009 #jd09nl
 
Non Conventional Android Programming En
Non Conventional Android Programming EnNon Conventional Android Programming En
Non Conventional Android Programming En
 
Page Caching Resurrected
Page Caching ResurrectedPage Caching Resurrected
Page Caching Resurrected
 
EPiServer Web Parts
EPiServer Web PartsEPiServer Web Parts
EPiServer Web Parts
 
Browser Extensions for Web Hackers
Browser Extensions for Web HackersBrowser Extensions for Web Hackers
Browser Extensions for Web Hackers
 
Grails and Dojo
Grails and DojoGrails and Dojo
Grails and Dojo
 
Accelerated Mobile - Beyond AMP
Accelerated Mobile - Beyond AMPAccelerated Mobile - Beyond AMP
Accelerated Mobile - Beyond AMP
 

Similar to Fast by Default

Web 2.0 Expo: Even Faster Web Sites
Web 2.0 Expo: Even Faster Web SitesWeb 2.0 Expo: Even Faster Web Sites
Web 2.0 Expo: Even Faster Web Sites
Steve Souders
 
Fronteers 20091105 (1)
Fronteers 20091105 (1)Fronteers 20091105 (1)
Fronteers 20091105 (1)
guestbf04d7
 
Web Directions South - Even Faster Web Sites
Web Directions South - Even Faster Web SitesWeb Directions South - Even Faster Web Sites
Web Directions South - Even Faster Web Sites
Steve Souders
 
Flash Security, OWASP Chennai
Flash Security, OWASP ChennaiFlash Security, OWASP Chennai
Flash Security, OWASP Chennai
lavakumark
 
Souders WPO Web 2.0 Expo
Souders WPO Web 2.0 ExpoSouders WPO Web 2.0 Expo
Souders WPO Web 2.0 Expo
Steve Souders
 
Souders WPO Web2.0Expo
Souders WPO Web2.0ExpoSouders WPO Web2.0Expo
Souders WPO Web2.0Expo
guest0b3d92d
 

Similar to Fast by Default (20)

SXSW: Even Faster Web Sites
SXSW: Even Faster Web SitesSXSW: Even Faster Web Sites
SXSW: Even Faster Web Sites
 
Web20expo 20080425
Web20expo 20080425Web20expo 20080425
Web20expo 20080425
 
Web 2.0 Expo: Even Faster Web Sites
Web 2.0 Expo: Even Faster Web SitesWeb 2.0 Expo: Even Faster Web Sites
Web 2.0 Expo: Even Faster Web Sites
 
Fronteers 20091105 (1)
Fronteers 20091105 (1)Fronteers 20091105 (1)
Fronteers 20091105 (1)
 
Google Gears
Google GearsGoogle Gears
Google Gears
 
Even Faster Web Sites at The Ajax Experience
Even Faster Web Sites at The Ajax ExperienceEven Faster Web Sites at The Ajax Experience
Even Faster Web Sites at The Ajax Experience
 
A Holistic View of Website Performance
A Holistic View of Website PerformanceA Holistic View of Website Performance
A Holistic View of Website Performance
 
Client-side JavaScript Vulnerabilities
Client-side JavaScript VulnerabilitiesClient-side JavaScript Vulnerabilities
Client-side JavaScript Vulnerabilities
 
ActiveWeb: Chicago Java User Group Presentation
ActiveWeb: Chicago Java User Group PresentationActiveWeb: Chicago Java User Group Presentation
ActiveWeb: Chicago Java User Group Presentation
 
Web Directions South - Even Faster Web Sites
Web Directions South - Even Faster Web SitesWeb Directions South - Even Faster Web Sites
Web Directions South - Even Faster Web Sites
 
Developing and testing ajax components
Developing and testing ajax componentsDeveloping and testing ajax components
Developing and testing ajax components
 
Flash templates for Joomla!
Flash templates for Joomla!Flash templates for Joomla!
Flash templates for Joomla!
 
Flash Security, OWASP Chennai
Flash Security, OWASP ChennaiFlash Security, OWASP Chennai
Flash Security, OWASP Chennai
 
WordPress Development Confoo 2010
WordPress Development Confoo 2010WordPress Development Confoo 2010
WordPress Development Confoo 2010
 
Non Conventional Android Programming (English)
Non Conventional Android Programming (English)Non Conventional Android Programming (English)
Non Conventional Android Programming (English)
 
JBUG 11 - Django-The Web Framework For Perfectionists With Deadlines
JBUG 11 - Django-The Web Framework For Perfectionists With DeadlinesJBUG 11 - Django-The Web Framework For Perfectionists With Deadlines
JBUG 11 - Django-The Web Framework For Perfectionists With Deadlines
 
Front End Development for Back End Java Developers - Jfokus 2020
Front End Development for Back End Java Developers - Jfokus 2020Front End Development for Back End Java Developers - Jfokus 2020
Front End Development for Back End Java Developers - Jfokus 2020
 
Souders WPO Web 2.0 Expo
Souders WPO Web 2.0 ExpoSouders WPO Web 2.0 Expo
Souders WPO Web 2.0 Expo
 
Souders WPO Web2.0Expo
Souders WPO Web2.0ExpoSouders WPO Web2.0Expo
Souders WPO Web2.0Expo
 
JSConf US 2010
JSConf US 2010JSConf US 2010
JSConf US 2010
 

Recently uploaded

Recently uploaded (20)

What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 
Tech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdfTech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdf
 

Fast by Default

  • 1. fast by default http://stevesouders.com/docs/amazon-20091030.pptx Disclaimer: This content does not necessarily reflect the opinions of my employer.
  • 2. GMail Mobile: http://googlecode.blogspot.com/2009/09/gmail-for-mobile-html5-series-reducing.html SproutCore: http://blog.sproutcore.com/post/225219087/faster-loading-through-eval Google, Bing biz metrics: http://en.oreilly.com/velocity2009/public/schedule/detail/8523 Yahoo! biz metrics: http://www.slideshare.net/stoyan/yslow-20-presentation Shopzilla biz metrics: http://en.oreilly.com/velocity2009/public/schedule/detail/7709 Netflix outbound traffic: http://en.oreilly.com/velocity2008/public/schedule/detail/3632 Google, Bing charts: http://www.watchingwebsites.com/archives/proof-that-speeding-up-websites-improves-online-business Aptimize WAX: http://blogs.msdn.com/sharepoint/archive/2009/09/28/how-we-did-it-speeding-up-sharepoint-microsoft-com.aspx Strangeloop Networks: http://www.watchingwebsites.com/archives/proof-that-speeding-up-websites-improves-online-business SproutCore: http://blog.sproutcore.com/post/196959232/how-sproutcore-makes-your-app-run-faster HTTP Archive Format: http://www.stevesouders.com/blog/2009/10/19/http-archive-specification-firebug-and-httpwatch/ @font-face: http://www.stevesouders.com/blog/2009/10/13/font-face-and-performance/
  • 4.
  • 5. 17% 83% iGoogle, primed cache the importance of frontend performance 9% 91% iGoogle, empty cache
  • 6. Make fewer HTTP requests Use a CDN Add an Expires header Gzip components Put stylesheets at the top Put scripts at the bottom Avoid CSS expressions Make JS and CSS external Reduce DNS lookups Minify JS Avoid redirects Remove duplicate scripts Configure ETags Make AJAX cacheable 14 Rules
  • 7. Even Faster Web Sites Splitting the initial payload Loading scripts without blocking Coupling asynchronous scripts Positioning inline scripts Sharding dominant domains Flushing the document early Using iframes sparingly Simplifying CSS Selectors Understanding Ajax performance..........Doug Crockford Creating responsive web apps............Ben Galbraith, Dion Almaer Writing efficient JavaScript.............Nicholas Zakas Scaling with Comet.....................Dylan Schiemann Going beyond gzipping...............Tony Gentilcore Optimizing images...................Stoyan Stefanov, Nicole Sullivan
  • 8. Yahoo! Wikipedia eBay AOL MySpace YouTube Facebook Why focus on JavaScript?
  • 9. scripts block <script src="A.js"> blocks parallel downloads and rendering 9 secs: IE 6-7, FF 3.0, Chr 1, Op 9-10, Saf 3 7 secs: IE 8, FF 3.5, Chr3, Saf 4
  • 10. 26% avg 252K avg initial payload and execution
  • 11. splitting the initial payload split your JavaScript between what's needed to render the page and everything else defer "everything else" split manually (Page Speed), automatically (Microsoft Doloto) load scripts without blocking – how?
  • 12. MSN Scripts and other resources downloaded in parallel! How? Secret sauce?! var p= g.getElementsByTagName("HEAD")[0]; var c=g.createElement("script"); c.type="text/javascript"; c.onreadystatechange=n; c.onerror=c.onload=k; c.src=e; p.appendChild(c) MSN.com: parallel scripts
  • 13. Loading Scripts Without Blocking XHR Eval XHR Injection Script in Iframe Script DOM Element Script Defer document.write Script Tag
  • 14. XHR Eval varxhrObj = 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 massage script?
  • 15. XHR Injection varxhrObj = getXHRObject(); xhrObj.onreadystatechange = function() { if ( xhrObj.readyState != 4 ) return; var se=document.createElement('script'); document.getElementsByTagName('head') [0].appendChild(se); se.text = xhrObj.responseText; }; xhrObj.open('GET', 'A.js', true); xhrObj.send(''); script must have same domain as main page
  • 16. Script in Iframe <iframe src='A.html' width=0 height=0 frameborder=0 id=frame1></iframe> iframe must have same domain as main page must refactor script: // access iframe from main page window.frames[0].createNewDiv(); // access main page from iframe parent.document.createElement('div');
  • 17. Script DOM Element var se = document.createElement('script'); se.src = 'http://anydomain.com/A.js'; document.getElementsByTagName('head') [0].appendChild(se); script & page domains can differ no need to massage JavaScript may not preserve execution order
  • 18. GMail Mobile <script type="text/javascript"> /* var ... */ </script> get script DOM element's text remove comments eval() when invoked inline or iframe awesome for prefetching JS that might (not) be needed
  • 19. SproutCore var module1 = "..."; var module2 = "..."; eval() modules as needed 2nd fastest downloading 2nd fastest loading symbols best alternative
  • 20. <script defer src='A.js'></script> supported in IE and FF 3.1+ script and main page domains can differ no need to refactor JavaScript Script Defer
  • 21. document.write("<script type='text/javascript' src='A.js'> <script>"); parallelization only works in IE parallel downloads for scripts, nothing else all document.writes must be in same script block document.writeScript Tag
  • 23. *Only other document.write scripts are downloaded in parallel (in the same script block). Load Scripts Without Blocking
  • 24. XHR Eval XHR Injection Script in iframe Script DOM Element Script Defer same domains different domains Script DOM Element Script Defer preserve order no order XHR Eval XHR Injection Script in iframe Script DOM Element (IE) Script DOM Element (FF) Script Defer (IE) Managed XHR Eval Managed XHR Injection no order preserve order Script DOM Element show busy no busy Script DOM Element (FF) Script Defer (IE) Managed XHR Injection Managed XHR Eval Script DOM Element (FF) Script Defer (IE) Managed XHR Eval Managed XHR Injection no busy show busy XHR Injection XHR Eval Script DOM Element (IE) Managed XHR Injection Managed XHR Eval Script DOM Element and the winner is...
  • 25. bad: stylesheet followed by inline script stylesheets load in parallel with other resources... ...unless followed by an inline script put inline JS above stylesheets or below other resources use Link, not @import
  • 26. MSN Wikipedia eBay MySpace mispositioned inline scripts
  • 27. <script type="text/javascript"> varamznJQ = { _a: [], _s: [], _d: [], _l: [], _o: [], _c: [], _cs: [], addLogical: function() { background-image: url(http://…/navPackedSprites_v12._V222883957_.png); <imgsrc="http://.../navPackedSprites_v12._V222883957_.png" style="display:none"/> var swmsMainContentImage_67691 = '<imgsrc="http://.../wl10_marquee_wk4-kindlelove._V228858619_.png">'; <!--[if (gte IE 5.5)&(lt IE 7)]> <script type="text/javascript"> if (document.body.filters) { swmsMainContentImage_67691 = '<img style="filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(en three script blocks between two script blocks between last resource onload
  • 28. last resource onload deferred ads!
  • 29. </style> <script type="text/javascript"> varamznJQ = { _a: [], _s: [], _d: [], _l: [], _o: [], _c: [], _cs: [], addLogical: function() { background-image: url(http://…/navPackedSprites_v12._V222883957_.png); <imgsrc="http://.../navPackedSprites_v12._V222883957_.png" style="display:none"/> last resource onload
  • 30. var swmsMainContentImage_67691 = '<imgsrc="http://.../wl10_marquee_wk4-kindlelove._V228858619_.png">'; <!--[if (gte IE 5.5)&(lt IE 7)]> <script type="text/javascript"> if (document.body.filters) { swmsMainContentImage_67691 = '<img style="filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(en last resource onload
  • 31. three script blocks between last resource onload
  • 32. two script blocks between last resource onload
  • 33. last resource loaded twice onload
  • 34. reduce HTTP use a CDN add Expires gzip minify configure ETags
  • 35.
  • 36. Google + 0.4 sec searches  0.6%
  • 37. Yahoo! + 0.4 sec traffic  5-9%
  • 38. Bing +2 sec revenue  4.3%
  • 39. Shopzilla -5 sec revenue 12% hw50%
  • 41.
  • 42. fast performance = better user experience more traffic more revenue reduced costs
  • 43. so... why don't more people do it?
  • 45.
  • 46. "if it wasn't hard everyone would do it" "the hard is what makes it great"
  • 47. this year's theme: Fast by Default
  • 48. Aptimize WAX concatenate scripts concatenate stylesheets sprites, data: URIs far future Expires minify JS and CSS automatically in real time
  • 49. WAX on: http://sharepoint.microsoft.com # requests empty: 96  35 # requests primed: 50  9 scripts 7, stylesheets 12, images 25 pages faster: 46-64% empty, 15-53% primed
  • 50. Strangeloop Networks "typical ecommerce site" pages per visit: 11  16 time on site: 24  30 mins conversions: 16% order value: 5.5%
  • 51. Rails far future Expires concatenate scripts domain sharding configure ETags in pipeline: async scripts, spriting, minification, flushing
  • 52. SproutCore concatenate scripts concatenate stylesheets versioning (future Expires) stylesheets at the top scripts at the bottom minify JS & CSS remove dupe scripts
  • 53. WPO
  • 54. Why do some sites feel slow ?
  • 57. AOL
  • 59. ESPN
  • 61. IKEA
  • 62. CNN
  • 65. WebPagetest.org VA, UK, NZ IE7, IE8 Dial, DSL, FIOS empty, empty & primed quad core Pat Meenan (AOL)
  • 66. News
  • 69. Progressive Enhancement deliver HTML defer JS avoid DOM decorate later
  • 70. Progressive Enhancement  Progressive Rendering
  • 71. news
  • 72. finds BG images groups into sprites generates sprite recomputes BG pos injects into page http://spriteme.org/
  • 75. @font-face blocks rendering in IE if below SCRIPT tag declare above all SCRIPTs
  • 76. Velocity OnLine Conference Dec 8, 9am-12:30pm PT HoomanBeheshti (StrangeLoop) Charles Jolley (SproutCore) Matt Cutts (Google) Artur Bergman (Wikia) Damien Katz (CouchDB)
  • 77. focus on the frontend run YSlow and Page Speed! progressive enhancement  progressive rendering takeaways
  • 78. SPEED is the next competitive advantage use it ...before someone else does
  • 79. Steve Souders souders@google.com http://stevesouders.com/docs/amazon-20091030.pptx
  • 80. GMail Mobile: http://googlecode.blogspot.com/2009/09/gmail-for-mobile-html5-series-reducing.html SproutCore: http://blog.sproutcore.com/post/225219087/faster-loading-through-eval Google, Bing biz metrics: http://en.oreilly.com/velocity2009/public/schedule/detail/8523 Yahoo! biz metrics: http://www.slideshare.net/stoyan/yslow-20-presentation Shopzilla biz metrics: http://en.oreilly.com/velocity2009/public/schedule/detail/7709 Netflix outbound traffic: http://en.oreilly.com/velocity2008/public/schedule/detail/3632 Google, Bing charts: http://www.watchingwebsites.com/archives/proof-that-speeding-up-websites-improves-online-business Aptimize WAX: http://blogs.msdn.com/sharepoint/archive/2009/09/28/how-we-did-it-speeding-up-sharepoint-microsoft-com.aspx Strangeloop Networks: http://www.watchingwebsites.com/archives/proof-that-speeding-up-websites-improves-online-business SproutCore: http://blog.sproutcore.com/post/196959232/how-sproutcore-makes-your-app-run-faster HTTP Archive Format: http://www.stevesouders.com/blog/2009/10/19/http-archive-specification-firebug-and-httpwatch/ @font-face: http://www.stevesouders.com/blog/2009/10/13/font-face-and-performance/

Editor's Notes

  1. YtseJam Photography, "Going nowhere fast", http://www.flickr.com/photos/thatguyfromcchs08/2300190277/
  2. Data Source: Steve Soudersaol 76%ebay 45%facebook 41%google 42%live search 9%msn 37%myspace 37%yahoo 45%youtube 60%wikipedia 26%average 42%
  3. Data source: Steve Souders
  4. Permission to use photo given by Brian.H - http://flickr.com/photos/robinofloxley/750220669/
  5. Of the ten top sites, MSN.com (Script DOM Element), Live Search (Script in Iframe), and Yahoo (Script DOM Element) use advanced script loading techniques.
  6. GMail Mobile: http://googlecode.blogspot.com/2009/09/gmail-for-mobile-html5-series-reducing.htmlSproutCore: http://blog.sproutcore.com/post/225219087/faster-loading-through-eval
  7. GMail Mobile: http://googlecode.blogspot.com/2009/09/gmail-for-mobile-html5-series-reducing.htmlSproutCore: http://blog.sproutcore.com/post/225219087/faster-loading-through-eval
  8. Audio (IE "click") is another busy indicator.Delayed rendering and delayed onload ("done") are other busy indicators.Sometimes busy indicators are bad, sometimes good.
  9. Data source: Steve Souders
  10. Joseph Smarr from Plaxo advocates interspersing setTimeout through JavaScript threads every n00 ms.
  11. Data source: Steve Souders
  12. Not sure if the gap is due to style&js interaction or just the inline script execution (new S9MultiPackLayout?).
  13. Not sure if the gap is due to style&js interaction or just the inline script execution (new S9MultiPackLayout?).
  14. Google, Bing: http://en.oreilly.com/velocity2009/public/schedule/detail/8523 Yahoo!: http://www.slideshare.net/stoyan/yslow-20-presentationShopzilla: http://en.oreilly.com/velocity2009/public/schedule/detail/7709Netflix: http://en.oreilly.com/velocity2008/public/schedule/detail/3632
  15. Google, Bing: http://en.oreilly.com/velocity2009/public/schedule/detail/8523 Yahoo!: http://www.slideshare.net/stoyan/yslow-20-presentationShopzilla: http://en.oreilly.com/velocity2009/public/schedule/detail/7709Netflix: http://en.oreilly.com/velocity2008/public/schedule/detail/3632
  16. Google, Bing: http://en.oreilly.com/velocity2009/public/schedule/detail/8523 Yahoo!: http://www.slideshare.net/stoyan/yslow-20-presentationShopzilla: http://en.oreilly.com/velocity2009/public/schedule/detail/7709Netflix: http://en.oreilly.com/velocity2008/public/schedule/detail/3632
  17. Google, Bing: http://en.oreilly.com/velocity2009/public/schedule/detail/8523 Yahoo!: http://www.slideshare.net/stoyan/yslow-20-presentationShopzilla: http://en.oreilly.com/velocity2009/public/schedule/detail/7709Netflix: http://en.oreilly.com/velocity2008/public/schedule/detail/3632
  18. Google, Bing: http://en.oreilly.com/velocity2009/public/schedule/detail/8523 Yahoo!: http://www.slideshare.net/stoyan/yslow-20-presentationShopzilla: http://en.oreilly.com/velocity2009/public/schedule/detail/7709Netflix: http://en.oreilly.com/velocity2008/public/schedule/detail/3632
  19. http://www.watchingwebsites.com/archives/proof-that-speeding-up-websites-improves-online-business0.21% decrease even 5 weeks after the delay was removed – users perception of a site is learnedNetflix: http://en.oreilly.com/velocity2008/public/schedule/detail/3632
  20. http://www.youtube.com/watch?v=m888nlVxZu8
  21. http://blogs.msdn.com/sharepoint/archive/2009/09/28/how-we-did-it-speeding-up-sharepoint-microsoft-com.aspx
  22. http://blogs.msdn.com/sharepoint/archive/2009/09/28/how-we-did-it-speeding-up-sharepoint-microsoft-com.aspx
  23. http://www.watchingwebsites.com/archives/proof-that-speeding-up-websites-improves-online-business
  24. http://blog.sproutcore.com/post/196959232/how-sproutcore-makes-your-app-run-faster
  25. 3000 kbps up, 600kbps downduo CPU Thinkpad X61Windows XPIE 7
  26. 3000 kbps up, 600kbps downduo CPU Thinkpad X61Windows XPIE 7
  27. 3000 kbps up, 600kbps downduo CPU Thinkpad X61Windows XPIE 7
  28. 3000 kbps up, 600kbps downduo CPU Thinkpad X61Windows XPIE 7
  29. 3000 kbps up, 600kbps downduo CPU Thinkpad X61Windows XPIE 7
  30. 3000 kbps up, 600kbps downduo CPU Thinkpad X61Windows XPIE 7
  31. 3000 kbps up, 600kbps downduo CPU Thinkpad X61Windows XPIE 7
  32. 3000 kbps up, 600kbps downduo CPU Thinkpad X61Windows XPIE 7
  33. http://stevesouders.com/p3/index.php?sites=google-search,yahoo-search,bing,ask,aol-search&ival=500
  34. http://stevesouders.com/p3/index.php?sites=yahoo-news,cnn,cnet,google-news,nytimes,msnbc,foxnews&ival=1000
  35. http://stevesouders.com/p3/index.php?sites=ebay,amazon,netflix,target,bestbuy,ikea&ival=2000
  36. http://stevesouders.com/p3/index.php?sites=ebay,amazon,netflix,target,bestbuy,ikea&ival=2000
  37. http://www.stevesouders.com/blog/2009/10/19/http-archive-specification-firebug-and-httpwatch/
  38. http://www.stevesouders.com/blog/2009/10/13/font-face-and-performance/
  39. http://www.stevesouders.com/blog/2009/10/13/font-face-and-performance/