SlideShare a Scribd company logo
1 of 35
best of steve http://stevesouders.com/docs/jsconfus-20100418.pptx Disclaimer: This content does not necessarily reflect the opinions of my employer. http://www.flickr.com/photos/lrargerich/3115367361/
http://www.flickr.com/photos/bekahstargazing/318930460/
the importance of  frontend performance 9% 91% 17% 83% iGoogle, primed cache iGoogle, empty cache http://www.flickr.com/photos/minami/2458184654/
Site speed in search rank Screen shot of blog post
Both combine scripts combine stylesheets add an Expires header gzip responses put stylesheets at the top put scripts at the bottom avoid CSS expressions make JS and CSS external reduce DNS lookups minify JS and CSS avoid redirects remove duplicate scripts make Ajax cacheable reduce cookie size use cookie-free domains don't scale images YSlow use CSS sprites use a CDN configure ETags use GET for Ajax requests reduce # of DOM elements no 404s avoid image filters optimize favicon Page Speed defer loading JS remove unused CSS use efficient CSS selectors optimize images optimize order of CSS & JS shard domains leverage proxy caching
P3PC Performance of 3rd Party Content Ads Widgets Analytics http://www.flickr.com/photos/ntr23/729463293/
document.getElementsByTagName('head‘)[0] .appendChild(domscript);  document.documentElement.firstChild .appendChild(ga); s = document.getElementsByTagName ('script')[0];  s.parentNode.insertBefore(ga, s); http://www.flickr.com/photos/amodiovalerioverde/425333516/ appendChild or insertBefore? - Souders (May 2008) - Google Analytics (Dec 2009) - Google Analytics (Feb 2010)
if (q.insertBefore) { var s = _get(q.insertBefore, id);   if (s) { s.parentNode.insertBefore(n, s);   } } else { h.appendChild(n); } - YUI Loader 2.6.0 (2008) http://www.flickr.com/photos/amodiovalerioverde/425333516/ appendChild or insertBefore?
head = document.getElementsByTagName ("head")[0] || document.documentElement; // Use insertBefore instead of appendChild to circumvent an IE6 bug. // This arises when a base node is used (#2709 and #4378). head.insertBefore(script, head.firstChild); - jQuery http://www.flickr.com/photos/amodiovalerioverde/425333516/ appendChild or insertBefore?
var f=document.getElementsByTagName("script"); var b=f[f.length-1];     // b is last script tag if(b==null){ return; } vari=document.createElement("script"); i.language="javascript"; // i is a script element i.setAttribute("type","text/javascript"); var j="";                // j is a string j+="document.write('<scr'+'ipt language=quot;javascriptquot; src=quot;"+c+"quot;></scr'+'ipt>');"; var g=document.createTextNode(j);  // not used b.parentNode.insertBefore(i,b); appendChild(i,j); function appendChild(a,b){   if(null==a.canHaveChildren||a.canHaveChildren){ a.appendChild(document.createTextNode(b));   }   else{ a.text=b;} } - Collective Media http://www.flickr.com/photos/amodiovalerioverde/425333516/ appendChild or insertBefore?
“Frag Tag” Alex Russell snippet <FRAG> <script src=“snippet.js”></script> </FRAG> doesn’t block rendering asyncdocument.write JavaScript sandboxing just a twinkle in my eye frag tag http://www.flickr.com/photos/bestrated1/2141687384/
browser wishlist http://www.stevesouders.com/blog/2010/02/15/browser-performance-wishlist/ Frag tag SPDY non-blocking scripts SCRIPT attributes resource packages border-radius cache redirects link prefetch Web Timing spec remote JS debugging web sockets History progressive XHR anchor ping stylesheet, inline js inline script defer @import @font-face stylesheets,iframes paint events missing schema http://www.flickr.com/photos/eole/380316678/
browser disk cache default size too small ,[object Object]
Firefox: 50M
Chrome: < 80Meviction algorithm improvements ,[object Object]
past impact: 1000 ms > 100 ms
preferred siteshttp://stevesouders.com/cache.php http://www.flickr.com/photos/minami/2458184654/
What makes sites feel slow? http://www.flickr.com/photos/kevincollins/234678305/
(lack of) Progressive Rendering [next page being loaded] http://www.flickr.com/photos/kevincollins/234678305/
Search
News
Shopping
Sports
Progressive Enhancement deliver HTML defer JS avoid DOM decorate later
Progressive Enhancement  Progressive Rendering
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
29% avg 229 K avg initial payload and execution

More Related Content

What's hot

Managing Chaos: Merging 120 Sites into a single Plone Multisite Solution
Managing Chaos: Merging 120 Sites into a single Plone Multisite SolutionManaging Chaos: Merging 120 Sites into a single Plone Multisite Solution
Managing Chaos: Merging 120 Sites into a single Plone Multisite SolutionClayton Parker
 
Liferay + Wearables
Liferay + WearablesLiferay + Wearables
Liferay + WearablesZeno Rocha
 
Mozilla Web Apps - Super-VanJS
Mozilla Web Apps - Super-VanJSMozilla Web Apps - Super-VanJS
Mozilla Web Apps - Super-VanJSRobert Nyman
 
关于 Html5 那点事
关于 Html5 那点事关于 Html5 那点事
关于 Html5 那点事Sofish Lin
 
Wookie Meetup
Wookie MeetupWookie Meetup
Wookie Meetupscottw
 
Djangoアプリのデプロイに関するプラクティス / Deploy django application
Djangoアプリのデプロイに関するプラクティス / Deploy django applicationDjangoアプリのデプロイに関するプラクティス / Deploy django application
Djangoアプリのデプロイに関するプラクティス / Deploy django applicationMasashi Shibata
 
Rendering SEO (explained by Google's Martin Splitt)
Rendering SEO (explained by Google's Martin Splitt)Rendering SEO (explained by Google's Martin Splitt)
Rendering SEO (explained by Google's Martin Splitt)Anton Shulke
 
Automated UI Testing Done Right (QMSDNUG)
Automated UI Testing Done Right (QMSDNUG)Automated UI Testing Done Right (QMSDNUG)
Automated UI Testing Done Right (QMSDNUG)Mehdi Khalili
 
Plugging into plugins
Plugging into pluginsPlugging into plugins
Plugging into pluginsJosh Harrison
 
Migrating a large scale banking app to compose
Migrating a large scale banking app to composeMigrating a large scale banking app to compose
Migrating a large scale banking app to composeFatih Giris
 
An introduction to juice
An introduction to juice An introduction to juice
An introduction to juice juiceproject
 
The patterns guide to the selenium
The patterns guide to the seleniumThe patterns guide to the selenium
The patterns guide to the seleniumGlobalLogic Ukraine
 
Clearance: Simple, complete Ruby web app authentication.
Clearance: Simple, complete Ruby web app authentication.Clearance: Simple, complete Ruby web app authentication.
Clearance: Simple, complete Ruby web app authentication.Jason Morrison
 
Scenic City Summit 2018 - Progressive Web Apps 101
Scenic City Summit 2018 - Progressive Web Apps 101Scenic City Summit 2018 - Progressive Web Apps 101
Scenic City Summit 2018 - Progressive Web Apps 101Frances Coronel
 

What's hot (19)

Taking your Web App for a walk
Taking your Web App for a walkTaking your Web App for a walk
Taking your Web App for a walk
 
Managing Chaos: Merging 120 Sites into a single Plone Multisite Solution
Managing Chaos: Merging 120 Sites into a single Plone Multisite SolutionManaging Chaos: Merging 120 Sites into a single Plone Multisite Solution
Managing Chaos: Merging 120 Sites into a single Plone Multisite Solution
 
Killer page load performance
Killer page load performanceKiller page load performance
Killer page load performance
 
Liferay + Wearables
Liferay + WearablesLiferay + Wearables
Liferay + Wearables
 
Oscon 20080724
Oscon 20080724Oscon 20080724
Oscon 20080724
 
Fast by Default
Fast by DefaultFast by Default
Fast by Default
 
Mozilla Web Apps - Super-VanJS
Mozilla Web Apps - Super-VanJSMozilla Web Apps - Super-VanJS
Mozilla Web Apps - Super-VanJS
 
关于 Html5 那点事
关于 Html5 那点事关于 Html5 那点事
关于 Html5 那点事
 
Wookie Meetup
Wookie MeetupWookie Meetup
Wookie Meetup
 
Djangoアプリのデプロイに関するプラクティス / Deploy django application
Djangoアプリのデプロイに関するプラクティス / Deploy django applicationDjangoアプリのデプロイに関するプラクティス / Deploy django application
Djangoアプリのデプロイに関するプラクティス / Deploy django application
 
Rendering SEO (explained by Google's Martin Splitt)
Rendering SEO (explained by Google's Martin Splitt)Rendering SEO (explained by Google's Martin Splitt)
Rendering SEO (explained by Google's Martin Splitt)
 
Automated UI Testing Done Right (QMSDNUG)
Automated UI Testing Done Right (QMSDNUG)Automated UI Testing Done Right (QMSDNUG)
Automated UI Testing Done Right (QMSDNUG)
 
React native - What, Why, How?
React native - What, Why, How?React native - What, Why, How?
React native - What, Why, How?
 
Plugging into plugins
Plugging into pluginsPlugging into plugins
Plugging into plugins
 
Migrating a large scale banking app to compose
Migrating a large scale banking app to composeMigrating a large scale banking app to compose
Migrating a large scale banking app to compose
 
An introduction to juice
An introduction to juice An introduction to juice
An introduction to juice
 
The patterns guide to the selenium
The patterns guide to the seleniumThe patterns guide to the selenium
The patterns guide to the selenium
 
Clearance: Simple, complete Ruby web app authentication.
Clearance: Simple, complete Ruby web app authentication.Clearance: Simple, complete Ruby web app authentication.
Clearance: Simple, complete Ruby web app authentication.
 
Scenic City Summit 2018 - Progressive Web Apps 101
Scenic City Summit 2018 - Progressive Web Apps 101Scenic City Summit 2018 - Progressive Web Apps 101
Scenic City Summit 2018 - Progressive Web Apps 101
 

Viewers also liked

Occupazione novembre 015 report 10 pptx.pptx
Occupazione  novembre 015 report 10 pptx.pptxOccupazione  novembre 015 report 10 pptx.pptx
Occupazione novembre 015 report 10 pptx.pptxgiovanni facco
 
Accent seminar
Accent seminarAccent seminar
Accent seminarMayur Garg
 
Concatenative bangla speech synthesizer model
Concatenative bangla speech synthesizer modelConcatenative bangla speech synthesizer model
Concatenative bangla speech synthesizer modelAbdullah al Mamun
 
A framework for bangla text to speech synthesis
A framework for bangla text to speech synthesisA framework for bangla text to speech synthesis
A framework for bangla text to speech synthesisSanjoy Dutta
 
Performance analysis of bangla speech recognizer model using hmm
Performance analysis of bangla speech recognizer model using hmmPerformance analysis of bangla speech recognizer model using hmm
Performance analysis of bangla speech recognizer model using hmmAbdullah al Mamun
 
Automatic speech recognition
Automatic speech recognitionAutomatic speech recognition
Automatic speech recognitionRichie
 

Viewers also liked (10)

Occupazione novembre 015 report 10 pptx.pptx
Occupazione  novembre 015 report 10 pptx.pptxOccupazione  novembre 015 report 10 pptx.pptx
Occupazione novembre 015 report 10 pptx.pptx
 
Accent seminar
Accent seminarAccent seminar
Accent seminar
 
Concatenative bangla speech synthesizer model
Concatenative bangla speech synthesizer modelConcatenative bangla speech synthesizer model
Concatenative bangla speech synthesizer model
 
A framework for bangla text to speech synthesis
A framework for bangla text to speech synthesisA framework for bangla text to speech synthesis
A framework for bangla text to speech synthesis
 
Acoustics
AcousticsAcoustics
Acoustics
 
Performance analysis of bangla speech recognizer model using hmm
Performance analysis of bangla speech recognizer model using hmmPerformance analysis of bangla speech recognizer model using hmm
Performance analysis of bangla speech recognizer model using hmm
 
Formant. PPTX.pptx
Formant. PPTX.pptxFormant. PPTX.pptx
Formant. PPTX.pptx
 
Bangla OCR
Bangla OCRBangla OCR
Bangla OCR
 
Speech acoustics
Speech acousticsSpeech acoustics
Speech acoustics
 
Automatic speech recognition
Automatic speech recognitionAutomatic speech recognition
Automatic speech recognition
 

Similar to JSConf US 2010

Souders WPO Web 2.0 Expo
Souders WPO Web 2.0 ExpoSouders WPO Web 2.0 Expo
Souders WPO Web 2.0 ExpoSteve Souders
 
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 SitesSteve Souders
 
Fast Loading JavaScript
Fast Loading JavaScriptFast Loading JavaScript
Fast Loading JavaScriptAaron Peters
 
Even Faster Web Sites at jQuery Conference '09
Even Faster Web Sites at jQuery Conference '09Even Faster Web Sites at jQuery Conference '09
Even Faster Web Sites at jQuery Conference '09Steve Souders
 
High Performance Mobile (SF/SV Web Perf)
High Performance Mobile (SF/SV Web Perf)High Performance Mobile (SF/SV Web Perf)
High Performance Mobile (SF/SV Web Perf)Steve Souders
 
Real-World AJAX with ASP.NET
Real-World AJAX with ASP.NETReal-World AJAX with ASP.NET
Real-World AJAX with ASP.NETgoodfriday
 
Guia de Sobrevivência JS no mundo Open Source
Guia de Sobrevivência JS no mundo Open SourceGuia de Sobrevivência JS no mundo Open Source
Guia de Sobrevivência JS no mundo Open SourceLeonardo Balter
 
High Performance Web Components
High Performance Web ComponentsHigh Performance Web Components
High Performance Web ComponentsSteve Souders
 
JavaScript performance patterns
JavaScript performance patternsJavaScript performance patterns
JavaScript performance patternsStoyan Stefanov
 
J Query - Your First Steps
J Query - Your First StepsJ Query - Your First Steps
J Query - Your First StepsBronson Quick
 
Build Better Responsive websites. Hrvoje Jurišić
Build Better Responsive websites. Hrvoje JurišićBuild Better Responsive websites. Hrvoje Jurišić
Build Better Responsive websites. Hrvoje JurišićMeetMagentoNY2014
 
Doctype html
Doctype htmlDoctype html
Doctype htmlEddy_TKJ
 
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 SitesSteve Souders
 
Web20expo 20080425
Web20expo 20080425Web20expo 20080425
Web20expo 20080425Media Gorod
 
SXSW: Even Faster Web Sites
SXSW: Even Faster Web SitesSXSW: Even Faster Web Sites
SXSW: Even Faster Web SitesSteve Souders
 
Google在Web前端方面的经验
Google在Web前端方面的经验Google在Web前端方面的经验
Google在Web前端方面的经验yiditushe
 
Fisl 11 - Dicas de Desenvolvimento Web com Ruby
Fisl 11 - Dicas de Desenvolvimento Web com RubyFisl 11 - Dicas de Desenvolvimento Web com Ruby
Fisl 11 - Dicas de Desenvolvimento Web com RubyFabio Akita
 

Similar to JSConf US 2010 (20)

Souders WPO Web 2.0 Expo
Souders WPO Web 2.0 ExpoSouders WPO Web 2.0 Expo
Souders WPO Web 2.0 Expo
 
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
 
Fast Loading JavaScript
Fast Loading JavaScriptFast Loading JavaScript
Fast Loading JavaScript
 
สปริงเฟรมเวิร์ค4.1
สปริงเฟรมเวิร์ค4.1สปริงเฟรมเวิร์ค4.1
สปริงเฟรมเวิร์ค4.1
 
Even Faster Web Sites at jQuery Conference '09
Even Faster Web Sites at jQuery Conference '09Even Faster Web Sites at jQuery Conference '09
Even Faster Web Sites at jQuery Conference '09
 
High Performance Mobile (SF/SV Web Perf)
High Performance Mobile (SF/SV Web Perf)High Performance Mobile (SF/SV Web Perf)
High Performance Mobile (SF/SV Web Perf)
 
Real-World AJAX with ASP.NET
Real-World AJAX with ASP.NETReal-World AJAX with ASP.NET
Real-World AJAX with ASP.NET
 
Guia de Sobrevivência JS no mundo Open Source
Guia de Sobrevivência JS no mundo Open SourceGuia de Sobrevivência JS no mundo Open Source
Guia de Sobrevivência JS no mundo Open Source
 
High Performance Web Components
High Performance Web ComponentsHigh Performance Web Components
High Performance Web Components
 
JavaScript performance patterns
JavaScript performance patternsJavaScript performance patterns
JavaScript performance patterns
 
J Query - Your First Steps
J Query - Your First StepsJ Query - Your First Steps
J Query - Your First Steps
 
Build Better Responsive websites. Hrvoje Jurišić
Build Better Responsive websites. Hrvoje JurišićBuild Better Responsive websites. Hrvoje Jurišić
Build Better Responsive websites. Hrvoje Jurišić
 
Doctype html
Doctype htmlDoctype html
Doctype html
 
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
 
Web20expo 20080425
Web20expo 20080425Web20expo 20080425
Web20expo 20080425
 
Sxsw 20090314
Sxsw 20090314Sxsw 20090314
Sxsw 20090314
 
SXSW: Even Faster Web Sites
SXSW: Even Faster Web SitesSXSW: Even Faster Web Sites
SXSW: Even Faster Web Sites
 
Google在Web前端方面的经验
Google在Web前端方面的经验Google在Web前端方面的经验
Google在Web前端方面的经验
 
Fisl 11 - Dicas de Desenvolvimento Web com Ruby
Fisl 11 - Dicas de Desenvolvimento Web com RubyFisl 11 - Dicas de Desenvolvimento Web com Ruby
Fisl 11 - Dicas de Desenvolvimento Web com Ruby
 
Upload[1]
Upload[1]Upload[1]
Upload[1]
 

More from Steve Souders

Make JavaScript Faster
Make JavaScript FasterMake JavaScript Faster
Make JavaScript FasterSteve Souders
 
Design+Performance Velocity 2015
Design+Performance Velocity 2015Design+Performance Velocity 2015
Design+Performance Velocity 2015Steve Souders
 
The Perception of Speed
The Perception of SpeedThe Perception of Speed
The Perception of SpeedSteve Souders
 
High Performance Web Components
High Performance Web ComponentsHigh Performance Web Components
High Performance Web ComponentsSteve Souders
 
Prebrowsing - Velocity NY 2013
Prebrowsing - Velocity NY 2013Prebrowsing - Velocity NY 2013
Prebrowsing - Velocity NY 2013Steve Souders
 
How fast are we going now?
How fast are we going now?How fast are we going now?
How fast are we going now?Steve Souders
 
High Performance Snippets
High Performance SnippetsHigh Performance Snippets
High Performance SnippetsSteve Souders
 
Your Script Just Killed My Site
Your Script Just Killed My SiteYour Script Just Killed My Site
Your Script Just Killed My SiteSteve Souders
 
JavaScript Performance (at SFJS)
JavaScript Performance (at SFJS)JavaScript Performance (at SFJS)
JavaScript Performance (at SFJS)Steve Souders
 
High Performance HTML5 (SF HTML5 UG)
High Performance HTML5 (SF HTML5 UG)High Performance HTML5 (SF HTML5 UG)
High Performance HTML5 (SF HTML5 UG)Steve Souders
 
@media - Even Faster Web Sites
@media - Even Faster Web Sites@media - Even Faster Web Sites
@media - Even Faster Web SitesSteve Souders
 
Browserscope Launch at TAE
Browserscope Launch at TAEBrowserscope Launch at TAE
Browserscope Launch at TAESteve Souders
 
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 ExperienceSteve Souders
 

More from Steve Souders (18)

Make JavaScript Faster
Make JavaScript FasterMake JavaScript Faster
Make JavaScript Faster
 
Metrics of Joy
Metrics of JoyMetrics of Joy
Metrics of Joy
 
Design+Performance
Design+PerformanceDesign+Performance
Design+Performance
 
Design+Performance Velocity 2015
Design+Performance Velocity 2015Design+Performance Velocity 2015
Design+Performance Velocity 2015
 
do u webview?
do u webview?do u webview?
do u webview?
 
The Perception of Speed
The Perception of SpeedThe Perception of Speed
The Perception of Speed
 
High Performance Web Components
High Performance Web ComponentsHigh Performance Web Components
High Performance Web Components
 
Prebrowsing - Velocity NY 2013
Prebrowsing - Velocity NY 2013Prebrowsing - Velocity NY 2013
Prebrowsing - Velocity NY 2013
 
How fast are we going now?
How fast are we going now?How fast are we going now?
How fast are we going now?
 
Cache is King
Cache is KingCache is King
Cache is King
 
High Performance Snippets
High Performance SnippetsHigh Performance Snippets
High Performance Snippets
 
Your Script Just Killed My Site
Your Script Just Killed My SiteYour Script Just Killed My Site
Your Script Just Killed My Site
 
JavaScript Performance (at SFJS)
JavaScript Performance (at SFJS)JavaScript Performance (at SFJS)
JavaScript Performance (at SFJS)
 
High Performance HTML5 (SF HTML5 UG)
High Performance HTML5 (SF HTML5 UG)High Performance HTML5 (SF HTML5 UG)
High Performance HTML5 (SF HTML5 UG)
 
@media - Even Faster Web Sites
@media - Even Faster Web Sites@media - Even Faster Web Sites
@media - Even Faster Web Sites
 
CouchDB Google
CouchDB GoogleCouchDB Google
CouchDB Google
 
Browserscope Launch at TAE
Browserscope Launch at TAEBrowserscope Launch at TAE
Browserscope Launch at TAE
 
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
 

JSConf US 2010

  • 1. best of steve http://stevesouders.com/docs/jsconfus-20100418.pptx Disclaimer: This content does not necessarily reflect the opinions of my employer. http://www.flickr.com/photos/lrargerich/3115367361/
  • 3. the importance of frontend performance 9% 91% 17% 83% iGoogle, primed cache iGoogle, empty cache http://www.flickr.com/photos/minami/2458184654/
  • 4. Site speed in search rank Screen shot of blog post
  • 5.
  • 6. Both combine scripts combine stylesheets add an Expires header gzip responses put stylesheets at the top put scripts at the bottom avoid CSS expressions make JS and CSS external reduce DNS lookups minify JS and CSS avoid redirects remove duplicate scripts make Ajax cacheable reduce cookie size use cookie-free domains don't scale images YSlow use CSS sprites use a CDN configure ETags use GET for Ajax requests reduce # of DOM elements no 404s avoid image filters optimize favicon Page Speed defer loading JS remove unused CSS use efficient CSS selectors optimize images optimize order of CSS & JS shard domains leverage proxy caching
  • 7.
  • 8.
  • 9.
  • 10.
  • 11. P3PC Performance of 3rd Party Content Ads Widgets Analytics http://www.flickr.com/photos/ntr23/729463293/
  • 12.
  • 13. document.getElementsByTagName('head‘)[0] .appendChild(domscript); document.documentElement.firstChild .appendChild(ga); s = document.getElementsByTagName ('script')[0]; s.parentNode.insertBefore(ga, s); http://www.flickr.com/photos/amodiovalerioverde/425333516/ appendChild or insertBefore? - Souders (May 2008) - Google Analytics (Dec 2009) - Google Analytics (Feb 2010)
  • 14. if (q.insertBefore) { var s = _get(q.insertBefore, id); if (s) { s.parentNode.insertBefore(n, s); } } else { h.appendChild(n); } - YUI Loader 2.6.0 (2008) http://www.flickr.com/photos/amodiovalerioverde/425333516/ appendChild or insertBefore?
  • 15. head = document.getElementsByTagName ("head")[0] || document.documentElement; // Use insertBefore instead of appendChild to circumvent an IE6 bug. // This arises when a base node is used (#2709 and #4378). head.insertBefore(script, head.firstChild); - jQuery http://www.flickr.com/photos/amodiovalerioverde/425333516/ appendChild or insertBefore?
  • 16. var f=document.getElementsByTagName("script"); var b=f[f.length-1]; // b is last script tag if(b==null){ return; } vari=document.createElement("script"); i.language="javascript"; // i is a script element i.setAttribute("type","text/javascript"); var j=""; // j is a string j+="document.write('<scr'+'ipt language=quot;javascriptquot; src=quot;"+c+"quot;></scr'+'ipt>');"; var g=document.createTextNode(j); // not used b.parentNode.insertBefore(i,b); appendChild(i,j); function appendChild(a,b){ if(null==a.canHaveChildren||a.canHaveChildren){ a.appendChild(document.createTextNode(b)); } else{ a.text=b;} } - Collective Media http://www.flickr.com/photos/amodiovalerioverde/425333516/ appendChild or insertBefore?
  • 17. “Frag Tag” Alex Russell snippet <FRAG> <script src=“snippet.js”></script> </FRAG> doesn’t block rendering asyncdocument.write JavaScript sandboxing just a twinkle in my eye frag tag http://www.flickr.com/photos/bestrated1/2141687384/
  • 18. browser wishlist http://www.stevesouders.com/blog/2010/02/15/browser-performance-wishlist/ Frag tag SPDY non-blocking scripts SCRIPT attributes resource packages border-radius cache redirects link prefetch Web Timing spec remote JS debugging web sockets History progressive XHR anchor ping stylesheet, inline js inline script defer @import @font-face stylesheets,iframes paint events missing schema http://www.flickr.com/photos/eole/380316678/
  • 19.
  • 21.
  • 22. past impact: 1000 ms > 100 ms
  • 24. What makes sites feel slow? http://www.flickr.com/photos/kevincollins/234678305/
  • 25. (lack of) Progressive Rendering [next page being loaded] http://www.flickr.com/photos/kevincollins/234678305/
  • 27. News
  • 30. Progressive Enhancement deliver HTML defer JS avoid DOM decorate later
  • 31. Progressive Enhancement  Progressive Rendering
  • 32. Yahoo! Wikipedia eBay AOL MySpace YouTube Facebook Why focus on JavaScript?
  • 33. 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
  • 34. 26% avg 252K avg initial payload and execution
  • 35. 29% avg 229 K avg initial payload and execution
  • 36. 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 http://www.flickr.com/photos/devcentre/108032900/
  • 39. HTTP Archive Format (HAR) http://www.flickr.com/photos/duncanfawkes/2585929403/
  • 40.
  • 41. speed matters focus on the frontend run Page Speed and YSlow progressive enhancement  progressive rendering http://stevesouders.com/cache.php takeaways http://www.flickr.com/photos/34771728@N00/361526991/
  • 42. Steve Souders souders@google.com http://stevesouders.com/docs/jsconfus-20100418.pptx http://flickr.com/photos/nj_dodge/187190601/

Editor's Notes

  1. YtseJam Photography, &quot;Going nowhere fast&quot;, http://www.flickr.com/photos/thatguyfromcchs08/2300190277/
  2. Time measurements from real users.
  3. http://stevesouders.com/p3/index.php?sites=google-search,yahoo-search,bing,ask,aol-search&amp;ival=500http://www.webpagetest.org/video/compare.php?tests=091019_2JHW,091019_2JHY,091019_2JHX,091019_2JJ0,091019_2JHZ&amp;ival=500google &amp; yahoo: http://www.webpagetest.org/video/view.php?id=091105_e6a07e497145cb5fc721e6f437e75a3cbing &amp; yahoo: http://www.webpagetest.org/video/view.php?id=091105_c5cca3a0bd59ca54fb1ba6f591228acfalso: http://www.webpagetest.org/video/view.php?id=091105_a005f5803aa983f897a94d52094d297f4b2e0e65.slow
  4. http://stevesouders.com/p3/index.php?sites=yahoo-news,cnn,cnet,google-news,nytimes,msnbc,foxnews&amp;ival=1000
  5. http://stevesouders.com/p3/index.php?sites=ebay,amazon,netflix,target,bestbuy,ikea&amp;ival=2000
  6. http://stevesouders.com/p3/index.php?sites=ebay,amazon,netflix,target,bestbuy,ikea&amp;ival=2000
  7. 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%
  8. Data source: Steve Souders
  9. Data source: Steve Souders
  10. http://www.stevesouders.com/blog/2009/10/19/http-archive-specification-firebug-and-httpwatch/