RWD BLOAT

0988796fb50136535a69cea314396cfa?s=47 Dave Rupert
November 11, 2014

RWD BLOAT

Responsive Web Design gets a bad rap for performance. I investigate and bust some myths. Originally given at Refresh Austin.

0988796fb50136535a69cea314396cfa?s=128

Dave Rupert

November 11, 2014
Tweet

Transcript

  1. RWD BLOAT Dave Rupert @davatron5000

  2. ATTACK OF THE EBSITE

  3. paravelinc.com

  4. retailmenot.com

  5. shoptalkshow.com

  6. “RWD IS BAD FOR PERFORMANCE.”

  7. I’M KINDA POST-RWD

  8. POST EXPLAINING WHY RWD IS A PRETTY GREAT AND INEXPENSIVE

    MULTI-DEVICE WEB STRATEGY
  9. None
  10. “RWD IS BAD FOR PERFORMANCE.”

  11. “Okay. What problems are you having?”

  12. “Oh, you know…

  13. “Oh, you know… jQuery

  14. “Oh, you know… jQuery …uhh…

  15. “Oh, you know… jQuery …uhh… web fonts…

  16. “Oh, you know… jQuery …uhh… images web fonts…

  17. “Oh, you know… jQuery …uhh… images web fonts… …uhh…

  18. “Oh, you know… jQuery …uhh… images web fonts… …uhh… web

    apps?
  19. NOT REALLY RWD SPECIFIC

  20. WEBSITES 2014 1000 1333 1667 2000 12/2014 1/2015 2/2015 3/2015

    4/2015 5/2015 6/2015 7/2015 8/2015 9/2015 10/2015 11/2015 Transfer KB Image KB
  21. “RWD IS BAD FOR PERFORMANCE.”

  22. “RWD IS BAD FOR PERFORMANCE.” A WEBSITE IN 2014

  23. “BLAME THE IMPLEMENTATION, NOT THE TECHNIQUE.” – Tim Kadlec

  24. FORDS AREN’T MADE WELL, SO CARS AREN’T A VIABLE MODE

    OF TRANSPORTATION
  25. “…but surely there’s footprint…”

  26. So I examined the best website ever made…

  27. None
  28. None
  29. FACTS I’m p experienced with RWD I care about performance

    I have third-party ads I have third-party comments I have multiple web fonts Including an icon font! I use jQuery GASP! OH THE HORROR! THE SHAME!!!!!!!1
  30. 16% 24% 18% 24% 14% 3% HTML CSS JS Images

    Fonts Analytics & Ads TOTAL: 174kb
  31. CSS: 24kb Media Queries 2.4kb 10% Vendor Prefixes 1.4kb 6%

  32. JS: 41.2kb jQuery 33.1kb 78% Prism.js, Lettering, etc 7kb 17.3%

    FitVids, FitText 2kb 4.7%
  33. Images: 31.92kb

  34. Images: 31.92kb

  35. None
  36. Fonts: 42.6kb Open Sans 31.7kb 54.1% Symbolset 26.8kb 45.8%

  37. TOTAL COST OF RESPONSIVE WEB DESIGN…

  38. 4.4KB

  39. SO, NOT RWD.

  40. LET’S TAKE A DEEPER LOOK

  41. Home Article PageSpeed (Mobile) 79 78 PageSpeed (Desktop) 93 91

    Start Render (3G) 1.3s 1.5s DOMContentLoaded 1.77s 1.83s Speed Index (3G) 1446 1749
  42. Speed Index (n) Some hippie math that tells you how

    fast it “feels” to load your website.
  43. HOW FAST IS FAST ENOUGH?

  44. http://timkadlec.com/2014/01/fast-enough/

  45. http://timkadlec.com/2014/01/fast-enough/

  46. #PROTIP IF PAUL IRISH FROM GOOGLE SAYS YOUR WEBSITE SHOULD

    LOAD WITH A SPEED INDEX UNDER 1000, YOUR WEBSITE SHOULD LOAD WITH A SPEED INDEX UNDER 1000.
  47. None
  48. PROBLEMS No text until ~2.5 seconds Webfonts blocking type rendering?

    Sub-optimal image spriting (172 icon font)? Time to first-byte is ~500ms, has no CSS in it
  49. BASELINE Home Article PageSpeed (Mobile) 79 78 PageSpeed (Desktop) 93

    91 Speed Index (3G) 1446 1749
  50. None
  51. 0. Normalize CSS Reset Normalize CSS Selectors 679 578 Home

    Speed Index 1446 1376 Article Speed Index 1749 1412
  52. 1. Unblock fonts Fonts in <head> Fonts with loadCSS() Home

    Speed Index 1376 1327 Article Speed Index 1412 1284
  53. function loadCSS( href, before, media ){ "use strict"; var ss

    = window.document.createElement( "link" ); var ref = before || window.document.getElementsByTagName( "script" )[ 0 ]; var sheets = window.document.styleSheets; ss.rel = "stylesheet"; ss.href = href; ss.media = "only x"; ref.parentNode.insertBefore( ss, ref ); function toggleMedia(){ var defined; for( var i = 0; i < sheets.length; i++ ){ if( sheets[ i ].href && sheets[ i ].href.indexOf( href ) > -1 ){ defined = true; } } if( defined ){ ss.media = media || "all"; } else { setTimeout( toggleMedia ); } } toggleMedia(); return ss; }
  54. 2. No jQuery

  55. 2. No jQuery

  56. 3. SVG Sprites <svg title="Home"> <use xlink:href="/images/spritemap.svg#icon-house"></use> </svg> http://css-tricks.com/svg-sprites-use-better-icon-fonts/

  57. 3. SVG Sprites Icon Font SVG Sprite Home Speed Index

    1327 1264 Article Speed Index 1284 1222
  58. 4. CSS Cleanup Icon Font SVG Sprite Home Speed Index

    1264 938 Article Speed Index 1222 1126 300pts just for cleaning house!
  59. MAKE YOUR WEBSITE FASTER WITH THIS ONE WEIRD TRICK.

  60. THE NEED FOR PERCEIVED SPEED

  61. THE NEED FOR PERCEIVED SPEED

  62. 5. CRITICAL CSS Calculate style rules that appear “above the

    fold” Print them in an inline <style> block in the <head> Lazyload your stylesheet at the bottom of the page
  63. <html> <head> <style> .blue{color:blue;} </style> </head> <body> <div class="blue"> Hello,

    world! </div> <script> function loadCSS( file ) { // stuff } loadCSS('css/stylesheet.css'); </script> </body> </html>
  64. PAINT WITH THE FIRST PACKET

  65. None
  66. None
  67. 5. CRITICAL CSS Normal Critical CSS Home Speed Index 938

    728 Article Speed Index 1126 1065
  68. FINAL RESULTS Home Article PageSpeed (Mobile) 79 → 98 78

    → 96 PageSpeed (Desktop) 93 → 98 91 → 97 Speed Index (3G) 1446 → 728 1749 → 1065
  69. “Yeah, sure. Maybe on a tiny blog. What about a

    real website?”
  70. None
  71. 47 HTTP Requests 3.6MB
 Speed Index 1307

  72. DESIGN DIRECTION

  73. 3 Webfonts 38 images 1.456MB in animated GIFs Chart.js Scroll-triggered

    animations and a Quiz with audio
  74. Two-color PNGs

  75. PERFORMANCE ANXIETY

  76. Enable GZIP Optimize images Minify and compress JS Lazyload images

    Setup Critical CSS Async/Defer Scripts More image optimization
  77. 50 HTTP Requests 2.4MB
 Speed Index 651

  78. None
  79. HAS 5K RETINA MAC AND A 3MB CONNECTION

  80. None
  81. None
  82. TOOLS

  83. None
  84. LESSON: THROTTLING IS SUPER IMPORTANT SINCE MOST OF THE WORLD

    WON’T HAVE GOOGLE FIBER FOR A FEW MORE YEARS. FUCK YEAH, AUSTIN TX.
  85. PNGQuant

  86. None
  87. LESSON:
 DESIGNERS, YOUR JOB IS NOT DONE UNTIL THE SITE

    SHIPS.
  88. None
  89. LESSON:
 PERFORMANCE IS EVERYONE’S JOB. NOT JUST DEVELOPERS.

  90. THANKS Dave Rupert @davatron5000

  91. ONE MORE THING…

  92. OVERUNDER Simple trivia for social people. Follow @overunderapp

  93. THANKS Dave Rupert @davatron5000