Notes from WPT Live Audit done by Tim Kadlec
First things first, go and watch the audit recording if you haven't already. It is awesome because you learn how to do an audit practically from an expert.
This blog post is just a notes that I am making while re-watching that audit. So, it might not be well structured. I would keep on updating it as and when I grasp more details of it.
Right Configuration for the test run for the Right audit
Choose 4G or fast 3G for both Mobile and Desktop. It is more realistic to the real world where people are using their mobiles on the go.
You should run the tests on Mobile and Desktop for a given browser. I explain the reason in the Chrome Field Performance section.
If there is a lot of JavaScript stuff going on e.g. Frameworks like React, it is useful to enable v8 Sampling Profiler.
Analyzing the Report
Stats Table
- Identify gaps b/w TTFB(when the first byte of content was received) and Start Render and FCP(First Contentful Paint).
- In an ideal world, we would want FCP to be the same as LCP but that might not be practically possible always.
- Even a 1 second gap is not that bad.
- If there is a big gap b/w TTFB and Start Render then there are some blocking resources(like blocking Javascript or CSS)
This is the CrUX data which is retrieved when the WPT test runs and snapshotted along with the report so that you can refer to that report anytime in future.
The data is for the URL you are testing and it is a 28 days rolling average i.e. it always represents last 28 days.
It can help in doing a kind of sanity check as to how accurate this test report is in comparison to how google sees it for real users.
You should run the test on both Mobile and Desktop for a given browser and choose that report to focus on first where the p75 Chrome Field Report(or CrUX report) value and the WPT test's values for Core Web Vitals are similar. I would focus on the second report in this case*(See the distance b/w the arrow pointing downwards and an arrow pointing upwards)*
Filmstrip View
Tips
- Start with 0.1s interval for thumbnail generations.
- Make Filmstrip sticky so that when you scroll down the waterfall, you always have Filmstrip in view.
- Choose Thumbnail size huge.
Waterfall
Check Web Vitals Troubleshooting page
It would give useful debugging info as follows.
- LCP
- Highlights the LCP element
- Shows the waterfall till the LCP
- CLS
- Gives you an interactive element which clearly tells you what moved when you hover over it.
- TBT
- Gives you a view of all JS resources.
- A breakdown by 'origin' of Blocking Time for all domains including the website.
Timeline View
- You can compare waterfall timings and JavaScript activity(blocking or non-blocking) and try to match the JS resource by name causing the blocking time in Timeline view.
- Library Detector - It quickly tells you what JS frameworks are being used by the website. You see it directly as a dynamically updating extension icon. So, no additional clicks required.
Optimization Ideas
LCP Image
- If the LCP Image is from a different domain than the website, it would cause a new connection to be setup(
DNS
+ TCP
+ SSL
) can be in range of ~500-600ms on low end Mobile Devices. See if you can move images to the same domain and with HTTP2/HTTP3 the existing connection(that was used to fetch the main document) would be used to fetch images
- If there are multiple images, they should all be on same domain(preferably the website domain itself) due to same reason mentioned above
- LCP images should be requested from the html itself instead of waiting for some JavaScript to come.
Miscellaneous Learnings
- Hydration can be costly.
- There can be a lot of bad things happening on the page but focus on what you are optimizing first. Identify the noise and separate it from useful knowledge.
- The network with the most Packet loss observed is WiFi. I would have guessed mobile network :D. A reference is required here.
- Network Throttling is at Packet level in WPT. You can learn about various types of throttling here. As the throttling is at packet level it is more realistic
- Web Vitals browser support is very limited right now. So, keep it in mind and do identify which browsers most of the traffic is coming from. Read https://sylormiller.com/posts/2020/core-web-vitals/#the-browser-problem for more details. LCP and CLS are Chromium(Chrome, Edge, Opera, Samsung Internet) only right now, though FCP is available in Safari and Firefox as well.
Note: I would keep on updating this blog post as, when and where it makes sense.