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

Optimising Website Performance

Optimising Website Performance

Optimising Website Performance & Chrome Dev Tools

Thomas Stapleton

November 07, 2016
Tweet

More Decks by Thomas Stapleton

Other Decks in Technology

Transcript

  1. Web Performance • How Fast does your webpage load •

    How Fast can a user interact with the page • How Fast does the application respond
  2. Client Side Optimisation “If your application is slow, people won’t

    use it.” - Fred Wilson • Versioning (fingerprint) assets • Compress and minify files
  3. Client Side Optimisation • Minify HTML • Only load critical

    content server side • Use async templates for non-critical components • Make sure your HTML is valid
  4. Client Side Optimisation • Minify CSS (PostCSS -> cssnano) •

    Bundle common SCSS/LESS into one stylesheet • Inline styles used for critical/non-critical components • Make sure your CSS is valid
  5. Client Side Optimisation • Minify JavaScript • Remove blocking JavaScript

    • Use a module loader • Make sure your JavaScript is versioned (fingerprinted)
  6. Client Side Optimisation • Only load scripts if they are

    required on the page • JavaScript bundles help… but don’t bundle everything • Use DRY, KISS & SOLID principles • Inline JavaScript if necessary
  7. Client Side Optimisation • Upload onto CDN if available •

    Version (image-v1.jpg) • Optimise images on upload (CMS) • Lazy Load images below window.innerHeight • Use SVGs where appropriate
  8. Client Side Optimisation • Blocking fonts slow page speed •

    Load fonts async • Avoid FOUT, FOIT, FOFT • Use only two fonts and two weights of each
  9. Serving Static Assets • If you’re using HTTPS, enable HTTP2

    • Two way proxy • Proxy cache • Correct headers e.g. e-tags, gzip, expiry
  10. Serving Static Assets Headers are important, make sure they’re set.

    X-* Headers are custom and like data- for HTML attributes
  11. Proxy Cache 10x Faster! • Time Taken: 1s > 0.1s

    • Individual Requests:10ms > 1ms • Transfer Rate: 38.6kb > 393.4kb Respond with 1000 304 requests a second
  12. Chrome Developer Tools Build with HTML, CSS and JavaScript and

    arguable the most used and best developer tools in any browser to date.
  13. Overview • Elements - DOM nodes • Console - Errors

    & logging • Sources - Downloaded files, snippets & debugging • Network - Latency & requests • Timeline - Time to first paint & processing • Profiles - Memory & execution time • Application - Cached files & browser data stores • Audits - Recommendations for network & performance improvements
  14. • Elements - DOM nodes • Console - Errors &

    logging • Sources - Downloaded files, snippets & debugging Overview • Network - Latency & requests • Timeline - Time to first paint & processing • Profiles - Memory & execution time • Application - Cached files & browser data stores • Audits - Recommendations for network & performance improvements Outline performance issues
  15. Network • See screenshots of progress • Replicate connection speed

    • Network queue overview • Protocol Type • Status • DOMContentLoaded • Load time • Breakdown of request processes
  16. Timeline • Paint times • FPS • JS Evaluating &

    Execution • Summary • Memory • Event Listeners
  17. Time to First Paint • A white page can be

    a valid ‘time to first paint’. • Large amounts of JavaScript execution blocking paint render. • The above is cause by poor code executing on scrolling.
  18. Profiles • Function Execution Times • Memory Allocation • Memory

    Usage & Monitoring • Direct JavaScript Function Monitoring
  19. Useful Links • https://developers.google.com/web/fundamentals/performance/critical-rendering- path/measure-crp • https://docs.google.com/document/d/ 18GmrZjkpA8fxmCehjgMUg2_ujQs04a7RXlm7m_YcxVM/mobilebasic • https://jakearchibald.com/2016/streams-ftw/#creating-one-stream-from-multiple-

    sources-to-supercharge-page-render-times • https://w3c.github.io/ServiceWorker/ • https://developers.google.com/web/fundamentals/performance/ • http://techblog.netflix.com/2015/08/making-netflixcom-faster.html • https://www.webpagetest.org/ • https://tools.pingdom.com/