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

GDG DevFest Suwon 2018 - Improve Web Performance (Cho eun)

GDG Suwon
November 13, 2018

GDG DevFest Suwon 2018 - Improve Web Performance (Cho eun)

GDG DevFest Suwon 2018 - Improve Web Performance (Cho eun)

GDG Suwon

November 13, 2018
Tweet

More Decks by GDG Suwon

Other Decks in Technology

Transcript

  1. Improve web performance Cho Eun Google Developer Experts Web Technologies

    Seoul, South Korea With ChromeDevTools & LightHouse
  2. RAIL is a user-centric performance model that breaks down the

    user's experience into key actions. RAIL's goals and guidelines aim to help developers and designers ensure a good user experience for each of these actions. By laying out a structure for thinking about performance, RAIL enables designers and developers to reliably target the work that has the highest impact on user experience.
  3. 0 to 16ms 0 to 100ms 100 to 300ms 300

    to 1000ms 1000ms or more 10000ms or more GOOD FAST DELAYED WELL… BAD TERRIBLE
  4. Summary • Focus on the user • Repond to user

    input in under 100ms • Produce a frame in under 10ms when animating or scrolling • Maximise main thread idle time • Load interactive content in under 5000ms
  5. Lighthouse is an open-source, automated tool for improving the quality

    of web pages. You can run it against any web page, public or requiring authentication. It has audits for performance, accessibility, progressive web apps, and more.
  6. Optimising Critical Rendering path refers to prioritising the display of

    content that relates to the current user action
  7. index.html <!DOCTPE html> <html> <head> <meta name=“viewport” content=“width=device-width, initial-scale=1”> <link

    href=“style.css” rel=“stylesheet” /> <title>HELLO WORLD</title> </head> <body> <p>Hello <span>web performance</span> students!</p> <div><img src=“photo.jpg”></div> </body> </html>
  8. style.css Body { font-size: 16px } P { font-weight: bold

    } Span { color: red } P span { display: none } Img { float: right }
  9. index.html <!DOCTPE html> <html> <head> <meta name=“viewport” content=“width=device-width, initial-scale=1”> <link

    href=“style.css” rel=“stylesheet” /> <title>HELLO WORLD</title> </head> <body> <div style=“width: 50%”> <div style=“width: 50%”>Hello World</div> </div> </body> </html>
  10. index.html <!DOCTPE html> <html> <head> <meta name=“viewport” content=“width=device-width, initial-scale=1”> <style>

    // Important Styles </style> <link href=“style.css” rel=“stylesheet” /> <title>HELLO WORLD</title> </head> <body> <p>Hello <span>web performance</span> students!</p> <div><img src=“photo.jpg”></div> </body> </html>
  11. function query(selector) { return Array.from(document.querySelectorAll(selector)); } var observer = new

    IntersectionObserver( // Pre-load items that are within 2 multiples of the visible viewport height. function(changes) { changes.forEach(function(change) { var container = change.target; var content = container.querySelector("template").content; container.appendChild(content); observer.unobserve(container); }); }, { rootMargin: "200% 0%" } ); // Set up lazy loading query(".lazy-loaded").forEach(function(item) { observer.observe(item); });