Se ha denunciado esta presentación.
Utilizamos tu perfil de LinkedIn y tus datos de actividad para personalizar los anuncios y mostrarte publicidad más relevante. Puedes cambiar tus preferencias de publicidad en cualquier momento.

High Performance HTML5 (SF HTML5 UG)

Tips for what to use (and avoid) in HTML5 for faster websites. This talk was for the San Francisco HTML5 User Group on July 28, 2011.

  • Inicia sesión para ver los comentarios

High Performance HTML5 (SF HTML5 UG)

  1. High Performance HTML5<br /><br />Disclaimer: This content does not necessarily reflect the opinions of my employer.<br /><br />
  2. Cuzillion<br />SpriteMe<br />YSlow<br />Hammerhead<br /><br />
  3. 2004<br />
  4.<br />#1. Speed: “First and foremost, we believe that speed is more than a feature. Speed is the most important feature.”<br />
  5.<br />
  6.<br />
  7. Yahoo!<br /> 0.4 sec slower<br /> traffic  5-9%<br /><br /><br />
  8.<br />…shaved 2.2 seconds off the average page load time and increased download conversions by 15.4%!<br />
  9.<br /><br />…shaved 2.2 seconds off the average page load time and increased download conversions by 15.4%!<br />
  10.<br />
  11.<br />
  12. Site speed in search rank<br />Screen shot of blog post<br />…we've decided to take site speed into account in our search rankings.<br /><br />
  13. Web<br />Performance<br />Optimization<br />WPO<br />drives traffic<br />improves UX<br />increases revenue<br />reduces costs<br /><br />
  14. High Performance HTML5<br /><br /><br />
  15. Web Performance Working Group<br />chartered June 2010<br />Web Timing<br /><ul><li>Navigation Timing
  16. User Timing
  17. Resource Timing</li></ul>Page Visibility<br />Script-based animations<br />Efficient script yielding<br /><br />
  18. Navigation Timing<br />var timing = performance.timing;<br />varloadtime = <br />timing.loadEventEnd –<br />timing.navigationStart;<br />Chrome, IE9+<br /><br /><br />
  19. Resource Timing<br /><ul><li>DNS, redirects, etc.
  20. security issues</li></ul>User Timing<br /><ul><li>for web apps
  21. mark, measure</li></ul><br />
  22.<br />Page Visibility<br />detect when page is visible<br /><ul><li>stats
  23. video & audio
  24. polling, DHTML
  25. performance: prefetching, prerendering</li></ul>Chrome 13: <br /><ul><li>document.webkitHidden
  26. webkitvisibilitychange</li></ul><br />
  27. script async & defer<br />parsing doesn’t wait for script:<br /><ul><li>async– executed when available
  28. defer – executed when parsing finished</li></ul>when is it downloaded?<br />missing:<br /><ul><li>download now, execute on demand
  29. defer download AND execution</li></ul>Chrome, Firefox, Safari 5.1, IE10<br /><br />
  30. app cache<br /><br />
  31.<br />
  32.<br />
  33. app cache<br />offline apps, longer cache<br /><!doctype html><br /><html manifest=“myapp.appcache”><br />myapp.appcache:<br />CACHE MANIFEST<br /># Revision: 1.28<br />CACHE:<br />/images/logo.gif<br />NETWORK:<br />/login.html<br />FALLBACK:<br />/index.html /offline.html<br />Content-Type: text/cache-manifest<br /><br />
  34. app cache gotchas<br />html docs w/ manifest are cached<br />404 => nothing is cached<br />size: 5MB+<br />must rev manifest to update resources<br />update is served on 2nd reload (?!?!)<br /><br />
  35. app cache<br />reload<br />1<br />2<br />push app <br />logo.gif = <br />user loads app<br />app cache is empty <br />fetch manifest<br />fetch logo.gif<br />app cache =<br />user sees<br />3<br />4<br />5<br />push app <br />logo.gif =<br />rev manifest <br />user loads app<br />app cache = <br />user sees<br />fetch manifest<br />fetch logo.gif<br />app cache =<br />user loads app again<br />app cache = <br />user sees<br />fetch manifest (304)<br />
  36. load twice workaround<br />window.applicationCache.addEventListener('updateready', <br />function(e) {  if ( window.applicationCache.status== <br />window.applicationCache.UPDATEREADY) {<br /> if ( confirm(“Load new content?”) ) {<br /> ...<br /><br /><br /><br />
  37. localStorage<br />window.localStorage: <br />setItem()<br />getItem()<br />removeItem()<br />clear()<br />also sessionStorage<br />all popular browsers, 5MB max<br /><br /><br /><br />
  38. localStorage as cache<br />1st doc: write JS & CSS blocks to localStorage<br />JUX.UXBaseControls.252CB7BF: (function(){...<br />JUX.FrameworkCore.A39F6425: (function(){...<br />set cookie with entries & version<br />RMSM=JUX.UXBaseControls.252CB7BF~ JUX.FrameworkCore.A39F6425~<br />later docs: read JS & CSS from localStorage<br />script.text = localStorage.getItem(JUX.UXBaseControls.252CB7BF)<br /><br /><br />
  39.<br />@font-face<br />* IE9 does not display a blank page, but does “flash” the element.<br /><br />Worth delaying most important design elements? Or entire page?<br />
  40. there’s more<br />CSS instead of images: border radius, linear & radial gradients, drop shadow<br />SVG, inline SVG, and canvas<br />video tag<br />WebSockets<br />web workers<br />builtin controls: progress, datetime<br /><br />
  41. and more<br />history –<br /><a ping<br />requestAnimationFrame – not timers<br />native JSON parse/stringify<br /><br /><br /><br />
  42. Thanks to…<br />Max Firtman<br />Tony Gentilcore<br />Paul Irish<br />Brad Neuberg<br />Kyle Scholz<br />Lindsey Simon<br />Annie Sullivan<br /><br />
  43.<br />
  44.<br />
  45.<br />
  46. bytes downloadedTop 100 vs Top 1000<br />Top 1000<br />Top 100<br />
  47.<br />
  48. speed matters<br />WPWG<br />window.performance<br />async & defer<br />app cache, localStorage<br />! @font-face<br />takeaways<br /><br />
  49. Steve Souders<br />@souders<br /><br />