Capstone: Diagnose a Slow Page End to End
Build an accurate mental model of what the browser does, from navigation and HTTP through parsing, rendering, storage, workers, security, and DevTools, so you can predict behavior and debug real pages.
What you will be able to do
#- Apply a repeatable diagnosis method across panels.
- Separate measured evidence from assumptions.
- Write a structured root-cause diagnosis.
Overview
#This lesson combines the earlier tools into one method.
The method
- Reproduce with a recorded Performance trace.
- Read Core Web Vitals to know which metric is bad.
- Use the Network waterfall to find slow or heavy requests.
- Use the flame chart to find long tasks on the main thread.
- Check layout and paint time for rendering cost.
- Take heap snapshots if memory grows.
A worked example
A product page has LCP of 4.2 s and INP of 350 ms. The Network panel shows a 1.2 MB uncompressed hero image with no Cache-Control. The Performance trace shows a 300 ms long task from a synchronous analytics script in the head. The fix: compress and preload the hero image, add Cache-Control: immutable, and load analytics with defer or move it to a worker. Re-measure to confirm LCP under 2.5 s and INP under 200 ms.
Writing the diagnosis
State the symptom, the metric, the evidence from each panel, the root cause, and the fix. Separate what you measured from what you assume. This is the same structure expected in a debugging interview.
Questions to carry forward
- Which panel gives the strongest evidence for a main-thread long task?
- How do you confirm a fix without a production deploy?
- What would you check first if memory grows over time?
Exercises
#Reference answers and expected output are authored, not executed in this browser. Nothing you type is run, and there is no Run or Pass control on this page.
Exercise 1Interview
A page has LCP 4.2 s and INP 350 ms. Walk through how you would diagnose and fix it, naming the tools and evidence at each step.
Reveal the reference answer
reference.textRecord a Performance trace to reproduce. Read Core Web Vitals to confirm both metrics are bad. In Network, find the LCP resource and check its size, format, compression, and cache headers. In the flame chart, find long tasks over 50 ms and use Bottom up to locate the hot function. Fix the LCP resource (compress, preload, cache) and break up or move the long task (defer, split, or worker). Re-measure with the same trace to confirm LCP under 2.5 s and INP under 200 ms.Authored expected output: A structured diagnosis naming the panels, evidence, root causes, and re-measurement.
The expected structure is symptom, metric, evidence per panel, root cause, fix, and confirmation. Naming the tool that produced each piece of evidence is what separates a real diagnosis from a guess.
Exercise 2Debug
The Performance trace shows a 300 ms long task from a synchronous analytics script in the head. Propose two fixes and state the trade-off.
starter.html<head> <script src="analytics.js"></script> </head>Reveal the reference answer
reference.html<script src="analytics.js" defer></script> or move analytics into a worker and send events over postMessage.Authored expected output: The main thread is no longer blocked during the critical window.
defer removes the parser block but still runs the script on the main thread after parsing. A worker removes the main-thread cost entirely but adds messaging complexity and cannot touch the DOM directly.
Common misconceptions
#- Fixing the largest file always fixes LCP.
- A single trace is enough to declare a regression fixed.
- You can skip re-measurement after a fix.
Your progress
#Answers, drafts and completion marks are stored only in this browser. Nothing is sent to a server and no account is used.
Verification: authored. Answers and outputs on this page are authored reference material, not executed results.