Web performance is a complicated topic, but over the years it’s become easier to articulate thanks to incredible advancements in performance features, their adoption in the browser ecosystem and tools that test and give insight into which techniques might speed up your site.
However, all too often a feature is implemented incorrectly, resulting in a lost opportunity for performance improvement. During this talk I’d like to explore a few common web performance techniques - some that you are likely already familiar with. We’ll dive into HTTP Archive data to find some examples of sites that are using them incorrectly, and explore the impact and potential benefits of fixing them.
https://www.meetup.com/web-performance-ny/events/286338923/
16. 16
If you are using dns-prefetch and the domain is used to load content on the same page,
use preconnect instead!
HTML
DNS TCP TLS HTTP request
DNS TCP TLS
DNS TCP TLS
DNS Prefetch
Preconnect
HTTP request
HTTP request
19. 19
Source: HTTP Archive, August 2022
18.1 Million
Preconnect Headers
8.6 Million
Preconnects in HTML
166K
Missing crossorigin
4.4 Million
Missing crossorigin
These work fine.
¯_(ツ)_/¯
Many are blocked by CORS
35. 35
406K
Sites’ with >5 first party
Images served compressed
Examples
https://www.telegraph.co.uk
https://www.costcotravel.com
https://www.ryanair.com
https://www.basspro.com
https://support.apple.com
36. 36
1.08 Million
Sites’ with first party fonts
(woff and woff2) served
compressed
Examples
https://www.petsmart.com
https://www.etsy.com
https://www.udemy.com
https://www.discord.com
https://peacocktv.com
41. 41
● Lazy Loading
○ Don’t lazy load above-the-fold images
○ Check Lighthouse audit for lazy loading LCP image
● Resource Hints and Early Hints
○ If using dns-prefetch for domains loaded on the same page, use preconnect
instead.
○ Are your Preconnects are actually being used? Check the crossorigin attributes
○ Check the console to ensure you don’t have unused preloads
● Compression
○ Using NGINX? Check your gzip compression levels
○ Test your largest resource - are compression levels within expected ranges?
○ Avoid compressing binary responses such as images.
● If you are using performance plugins, validate that they are doing what you expect.