Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Better performance for component-based web apps

Better performance for component-based web apps

Modern tools are fun to use and they are useful to create websites with great performance.

This talk aims to show how to apply ideas like code-splitting, lazy-loading and CSS-in-JS (aka JSS) to websites built with components. This represents a superior way of delivering to the user only the assets that are needed and it's essential for creating fast loading sites.

We might be suffering from JS fatigue, trying to keep up to date with the latest and greatest. We don't need to rush, just understand what these techniques do and how they fit in the bigger picture.

José M. Pérez

November 30, 2018
Tweet

More Decks by José M. Pérez

Other Decks in Technology

Transcript

  1. Better performance for component-based web apps Madrid | November 30

    - December 1, 2018 José M. Pérez - @jmperezperez
  2. What we'll talk about What we'll talk about BETTER PERFORMANCE

    FOR COMPONENT-BASED WEB APPS @jmperezperez
  3. What we'll talk about What we'll talk about BETTER PERFORMANCE

    FOR COMPONENT-BASED WEB APPS @jmperezperez Modern libraries/frameworks
  4. What we'll talk about What we'll talk about BETTER PERFORMANCE

    FOR COMPONENT-BASED WEB APPS @jmperezperez ES6 Modern libraries/frameworks
  5. What we'll talk about What we'll talk about BETTER PERFORMANCE

    FOR COMPONENT-BASED WEB APPS @jmperezperez Code Splitting Modern libraries/frameworks ES6
  6. What we'll talk about What we'll talk about BETTER PERFORMANCE

    FOR COMPONENT-BASED WEB APPS @jmperezperez CSS-in-JS Modern libraries/frameworks ES6 Code Splitting
  7. What we'll talk about What we'll talk about BETTER PERFORMANCE

    FOR COMPONENT-BASED WEB APPS @jmperezperez Combine all to build sites with great performance Modern libraries/frameworks ES6 Code Splitting CSS-in-JS
  8. …and survive the …and survive the JavaScript fatigue JavaScript fatigue

    BETTER PERFORMANCE FOR COMPONENT-BASED WEB APPS @jmperezperez
  9. Who I am Who I am BETTER PERFORMANCE FOR COMPONENT-BASED

    WEB APPS @jmperezperez Senior Software Engineer at Spotify Google Developer Expert in Web Technologies
  10. Who I am Who I am BETTER PERFORMANCE FOR COMPONENT-BASED

    WEB APPS @jmperezperez Senior Software Engineer at Spotify Google Developer Expert in Web Technologies
  11. Who I am Who I am BETTER PERFORMANCE FOR COMPONENT-BASED

    WEB APPS @jmperezperez Senior Software Engineer at Spotify Google Developer Expert in Web Technologies
  12. Who I am Who I am BETTER PERFORMANCE FOR COMPONENT-BASED

    WEB APPS @jmperezperez Senior Software Engineer at Spotify Google Developer Expert in Web Technologies
  13. Who I am Who I am BETTER PERFORMANCE FOR COMPONENT-BASED

    WEB APPS @jmperezperez Senior Software Engineer at Spotify Google Developer Expert in Web Technologies I build things using web
  14. We ❤ modern tools We ❤ modern tools BETTER PERFORMANCE

    FOR COMPONENT-BASED WEB APPS @jmperezperez
  15. Do not blame the user Do not blame the user

    BETTER PERFORMANCE FOR COMPONENT-BASED WEB APPS @jmperezperez
  16. Do not blame the user Do not blame the user

    Low end device? Might not afford new one BETTER PERFORMANCE FOR COMPONENT-BASED WEB APPS @jmperezperez
  17. Do not blame the user Do not blame the user

    Low end device? Might not afford new one Old browser? Might not have permissions to install new one BETTER PERFORMANCE FOR COMPONENT-BASED WEB APPS @jmperezperez
  18. Do not blame the user Do not blame the user

    Low end device? Might not afford new one Old browser? Might not have permissions to install new one Slow network? On a plane, subway, public wifi, limited data plan... BETTER PERFORMANCE FOR COMPONENT-BASED WEB APPS @jmperezperez
  19. Welcome to the era Welcome to the era of of

    <components /> <components /> BETTER PERFORMANCE FOR COMPONENT-BASED WEB APPS @jmperezperez
  20. Serving a large bundle in Serving a large bundle in

    the old days the old days BETTER PERFORMANCE FOR COMPONENT-BASED WEB APPS @jmperezperez
  21. Server-Side Rendering a Slow App Server-Side Rendering a Slow App

    BETTER PERFORMANCE FOR COMPONENT-BASED WEB APPS @jmperezperez
  22. Server-Side Rendering Trade-off Server-Side Rendering Trade-off Server-Side Rendering Client-Side Rendering

    Waiting for server response time BETTER PERFORMANCE FOR COMPONENT-BASED WEB APPS @jmperezperez
  23. Server-Side Rendering Trade-off Server-Side Rendering Trade-off Server-Side Rendering Client-Side Rendering

    Waiting for server response Blank page time BETTER PERFORMANCE FOR COMPONENT-BASED WEB APPS @jmperezperez
  24. Server-Side Rendering Trade-off Server-Side Rendering Trade-off Server-Side Rendering Client-Side Rendering

    Waiting for server response Blank page Execute JS time BETTER PERFORMANCE FOR COMPONENT-BASED WEB APPS @jmperezperez
  25. Server-Side Rendering Trade-off Server-Side Rendering Trade-off Server-Side Rendering Client-Side Rendering

    Waiting for server response Blank page Execute JS time BETTER PERFORMANCE FOR COMPONENT-BASED WEB APPS @jmperezperez Ready
  26. Server-Side Rendering Trade-off Server-Side Rendering Trade-off Server-Side Rendering Waiting for

    server response Client-Side Rendering Waiting for server response Blank page Execute JS time BETTER PERFORMANCE FOR COMPONENT-BASED WEB APPS @jmperezperez Ready
  27. Server-Side Rendering Trade-off Server-Side Rendering Trade-off Server-Side Rendering Waiting for

    server response Visible, non-interactive page Client-Side Rendering Waiting for server response Blank page Execute JS time BETTER PERFORMANCE FOR COMPONENT-BASED WEB APPS @jmperezperez Ready
  28. Server-Side Rendering Trade-off Server-Side Rendering Trade-off Server-Side Rendering Waiting for

    server response Visible, non-interactive page Client-Side Rendering Waiting for server response Blank page Execute JS time BETTER PERFORMANCE FOR COMPONENT-BASED WEB APPS @jmperezperez Ready Execute JS
  29. Server-Side Rendering Trade-off Server-Side Rendering Trade-off Server-Side Rendering Waiting for

    server response Visible, non-interactive page Client-Side Rendering Waiting for server response Blank page Execute JS time BETTER PERFORMANCE FOR COMPONENT-BASED WEB APPS @jmperezperez Ready Ready Execute JS
  30. Solution Solution Serve to the user Serve to the user

    just what is needed just what is needed BETTER PERFORMANCE FOR COMPONENT-BASED WEB APPS @jmperezperez
  31. How we used to ensure How we used to ensure

    dependencies dependencies BETTER PERFORMANCE FOR COMPONENT-BASED WEB APPS @jmperezperez
  32. We didn't have a way* to We didn't have a

    way* to define dependencies define dependencies * With the exception of YUI Loader, Require.JS and custom tools BETTER PERFORMANCE FOR COMPONENT-BASED WEB APPS @jmperezperez
  33. Modelling a web site has Modelling a web site has

    pages as dependencies pages as dependencies BETTER PERFORMANCE FOR COMPONENT-BASED WEB APPS @jmperezperez
  34. Code Splitting at Path Level Code Splitting at Path Level

    bundle.js bundle.js hom e.js about.js contact.js BETTER PERFORMANCE FOR COMPONENT-BASED WEB APPS @jmperezperez
  35. THIS IS GREAT THIS IS GREAT Serve the code for

    the current path BETTER PERFORMANCE FOR COMPONENT-BASED WEB APPS @jmperezperez
  36. More importantly More importantly Adding features has no cost in

    Adding features has no cost in payload / rendering time payload / rendering time BETTER PERFORMANCE FOR COMPONENT-BASED WEB APPS @jmperezperez
  37. Lazy Loading Lazy Loading Image Text with web font BETTER

    PERFORMANCE FOR COMPONENT-BASED WEB APPS @jmperezperez Viewport
  38. Lazy Loading Lazy Loading Image Text with web font Other

    components BETTER PERFORMANCE FOR COMPONENT-BASED WEB APPS @jmperezperez Viewport
  39. THIS IS EVEN GREATER THIS IS EVEN GREATER Serve the

    code for the current path BETTER PERFORMANCE FOR COMPONENT-BASED WEB APPS @jmperezperez
  40. THIS IS EVEN GREATER THIS IS EVEN GREATER Serve the

    code for the current path screen BETTER PERFORMANCE FOR COMPONENT-BASED WEB APPS @jmperezperez
  41. BETTER PERFORMANCE FOR COMPONENT-BASED WEB APPS @jmperezperez THIS IS EVEN

    MORE THIS IS EVEN MORE GREATER GREATER Serve the code for the current screen
  42. THIS IS EVEN MORE THIS IS EVEN MORE GREATER GREATER

    Serve the code for the current screen and browser BETTER PERFORMANCE FOR COMPONENT-BASED WEB APPS @jmperezperez
  43. CSS-in-JS CSS-in-JS Breaking down the Breaking down the styles monolith

    styles monolith BETTER PERFORMANCE FOR COMPONENT-BASED WEB APPS @jmperezperez
  44. Code splitting + CSS-in-JS Code splitting + CSS-in-JS bundle.js account.js

    about.js blog.js JS code CSS code within JS BETTER PERFORMANCE FOR COMPONENT-BASED WEB APPS @jmperezperez
  45. THIS IS AMAZING THIS IS AMAZING Serve the code for

    the current screen and browser BETTER PERFORMANCE FOR COMPONENT-BASED WEB APPS @jmperezperez
  46. THIS IS AMAZING THIS IS AMAZING Serve the code Break

    the behemoth of JS and CSS for the current screen and browser BETTER PERFORMANCE FOR COMPONENT-BASED WEB APPS @jmperezperez
  47. JS fatigue JS fatigue These are tools. Add them These

    are tools. Add them to your toolbox. to your toolbox.
  48. JS fatigue JS fatigue These are tools. Add them These

    are tools. Add them to your toolbox. to your toolbox. Look at the bigger picture Look at the bigger picture