Frontend System Design · Lesson 24 of 86 · 4 min
Measuring Performance: Lighthouse and WebPageTest
In an interview, you need to justify performance work with data. This is how you get that data.
You can't fix what you can't measure. Lighthouse and WebPageTest are the two standard tools for gathering performance data. They answer different questions, and knowing which one to use for a given problem is a core engineering skill.
Lighthouse gives you a broad, automated audit. WebPageTest gives you a deep, granular diagnostic. You need both.
Use Lighthouse for quick, repeatable checks
Lighthouse is your first stop. It runs a series of audits against a URL in a simulated environment—typically a throttled CPU and network on a mobile device profile. The output is a report with scores from 0-100 for Performance, Accessibility, Best Practices, and SEO.
Its main purpose is to give you a consistent, repeatable baseline. Use it during local development to see the impact of your changes. More importantly, run it in your CI/CD pipeline to automatically catch performance regressions before they hit production.
The trap: Don't obsess over getting a perfect score of 100. The score is a guide. The real value is in the "Opportunities" and "Diagnostics" sections, which give you a prioritized list of what to fix, like "Eliminate render-blocking resources" or "Reduce initial server response time."
You can run Lighthouse directly from Chrome DevTools, but the command-line interface (CLI) is better for automation.
# Install it once globally
npm install -g lighthouse
# Run an audit on a URL, save it as an HTML file,
# and automatically open the report in your browser.
lighthouse https://www.example.com --output html --output-path ./report.html --view
Use WebPageTest for deep-dive diagnostics
When Lighthouse tells you what is slow, WebPageTest helps you find out why.
WebPageTest runs tests from multiple locations around the world using real browsers on real devices with various network conditions. It doesn't give you a simple score. Instead, it provides incredibly detailed reports, with its most valuable feature being the network waterfall chart.
The waterfall chart visualizes every single request the browser makes to render your page. It shows you what's blocking the critical rendering path, which assets are taking too long to download, and where network latency is hurting you.
Use WebPageTest when you need to:
- Diagnose a complex performance issue that isn't obvious from a Lighthouse report.
- Understand why real users in a specific geographic region are having a slow experience.
- Benchmark your site against a competitor in fine detail.
- Analyze the impact of third-party scripts.
In an interview, the waterfall chart is your evidence. Instead of saying "I would reduce the number of scripts," say "I would look at the WebPageTest waterfall to identify long-running scripts or chains of dependent requests that might be blocking the main thread, and then investigate deferring or inlining them."
How to choose the right tool
The tools are complementary. Your workflow determines which one you reach for. Lighthouse is for routine check-ups; WebPageTest is for specialist consultations.
A common workflow is to use Lighthouse to identify a problem (e.g., "Largest Contentful Paint is 5.2s") and then use WebPageTest to diagnose the root cause (e.g., "The LCP image is blocked from downloading for 3s by a render-blocking CSS file").
How to talk about performance tools
When asked how you'd improve a slow website, frame your answer around a measurement-driven process.
Start by stating the difference: "First, I'd need to understand the problem with data. I'd use Lighthouse for a quick, automated audit to identify the low-hanging fruit. It gives us repeatable lab data. For deeper, real-world issues, especially network-related ones, I'd use WebPageTest to get a detailed waterfall chart from a relevant location."
Then, describe a hypothetical workflow. "For example, if Lighthouse flags 'Eliminate render-blocking resources,' I'd use WebPageTest to see exactly which CSS or JS files are blocking the start render time. The waterfall chart would show me the request chain, and I could then decide whether to inline critical CSS, or add async or defer attributes to the scripts."
This shows you don't just guess. You diagnose problems systematically.
Try it
Pick a news website or a complex e-commerce site. Run a Lighthouse audit on it from Chrome DevTools with the "Mobile" device setting. Note the top performance "Opportunity." Now, run the same URL through webpagetest.org using a "Mobile - 4G" connection. Find the corresponding issue in the waterfall chart. For example, if Lighthouse suggests "Reduce unused JavaScript," find that large JS bundle in the waterfall and see what other requests it might be blocking.
Next: Now that you can find performance bottlenecks, we'll cover the most common fix in Asset Compression and Minification Basics.
Lock it in — apply this lesson under interview conditions.