Skip to content
Tutorials Center
My learning

Topics

Lesson 31 of 37 ยท Measuring and Monitoring

A DevTools Profiling Workflow

A repeatable method to find a slow page's real bottleneck with Chrome DevTools: Network waterfall, Performance recording, flame chart, long tasks and Insights.

Guessing at performance problems wastes time. Profiling replaces guessing with evidence. This lesson gives you a repeatable workflow in Chrome DevTools (the same ideas apply to Edge, Firefox and Safari tools) so you can find the real bottleneck on any slow page.

Step 0: set up a fair test

Slow problems appear on slow devices, so reproduce them:

  1. Open an Incognito window so extensions and cached data do not interfere.
  2. Open DevTools and, in the Network panel, tick Disable cache and choose a throttling profile such as Fast 4G or Slow 4G.
  3. In the Performance panel settings, set CPU: 4x slowdown (or 6x for low-end phones).
  4. Keep DevTools docked and the browser window the same size between runs.

Write down what you test: the URL, the throttling and the action ("click Add to cart"). Consistency makes before and after comparable.

Step 1: the Network panel (is it the network?)

Reload and read the waterfall: each row is a request, drawn from when it started to when it finished.

flowchart LR
  A["HTML<br/>document"] --> B["CSS"]
  A --> C["JS"]
  C --> D["API call"]
  D --> E["Hero image"]

A chain like this means each file waits for the previous one to be discovered.

Look for:

  • A late start: requests that begin long after the HTML arrives are discovered late. Fix with preload, earlier discovery or inlining.
  • Long bars (green wait = server time, blue = download time).
  • Big files: sort by Size.
  • Chains: API call waiting for script waiting for CSS.
  • Third parties (filter with -domain:yoursite.com).
  • Blocking resources: the Priority column and the render-blocking indicator.

You can filter the column Initiator to see who requested a file, which helps trace unexpected downloads.

Step 2: record a trace in the Performance panel

Click the record with reload button (circular arrow), wait for the page to settle, and stop. You get a timeline with several tracks:

  • Frames and Timings show LCP, FCP and DOMContentLoaded markers.
  • Network shows requests aligned with time.
  • Main is the flame chart of everything the main thread did.
  • Long tasks are marked with a red corner at the top right.

Click a long task and look at the Bottom-up and Call tree tabs in the summary pane. Bottom-up shows which functions spent the most self time; Call tree shows who called them.

Step 3: read the flame chart

Each bar is a function call. Its width is time, and bars stacked below it are the functions it called. Look for:

  • Very wide bars at the bottom of a tall stack: the real cost.
  • Many narrow bars repeated: a loop calling something small thousands of times.
  • Colors: yellow = scripting, purple = style and layout, green = paint, grey = other/system.

Purple blocks with a red triangle mean forced reflow (see Layout thrashing). Wide yellow blocks inside event handlers are your code blocking input.

Step 4: test an interaction

To investigate slow clicks, start recording, perform the action once, and stop. In the interaction track, a long bar shows the three parts of INP:

  1. Input delay: time before your handler started (the thread was busy).
  2. Processing time: your event handlers.
  3. Presentation delay: time from the end of handlers to the next paint (style, layout, paint).

The fix depends on which part is big: reduce earlier long tasks, shorten handlers, or reduce the rendering work that follows.

Step 5: add your own marks

Use User Timing marks so your code shows up in the trace:

JS Marks that appear in a trace

Press Run (or Ctrl + Enter) to see the console output here.

No output.

In DevTools these appear in the Timings track of the Performance panel.

Step 6: memory and rendering tools

  • Memory panel: heap snapshots for leaks (memory leaks lesson).
  • Rendering panel: Paint flashing, Layout shift regions and Frame rendering stats show repainting and shifts as you use the page.
  • Coverage: unused CSS and JavaScript.
  • Lighthouse and the Performance insights side panel summarize findings in words and link them to the trace.

A worked example: the story of a slow click

Suppose clicking "Filter" takes 900 ms.

  1. Record the click: the trace shows one task of 880 ms.
  2. Bottom-up says renderRows has 700 ms of self time and getBoundingClientRect inside it is purple (forced layout).
  3. Fix: read geometry once before the loop and render only visible rows.
  4. Record again: the task is 120 ms. The change is proven, not guessed.
JS Compare before and after

Press Run (or Ctrl + Enter) to see the console output here.

No output.

Workflow summary

  1. Reproduce with throttling and a clean browser.
  2. Network panel: find late, large, blocking and chained requests.
  3. Performance panel: find long tasks and the functions behind them.
  4. Fix the biggest item only.
  5. Measure again; keep the change only if the number improved.

Check your understanding

Quick check ยท 4 questions

of 4 answered You scored / 4 ยท perfect!

  1. 1. In the flame chart, what does the width of a bar represent?

    Wider bars mean more time; tall stacks show nested calls.
  2. 2. What do purple blocks with a red triangle usually indicate?

    Layout work triggered by JavaScript reading geometry is flagged as forced reflow.
  3. 3. Which is NOT one of the three parts of an interaction's latency?

    DNS is a network step during loading; interactions are split into input delay, processing and presentation.
  4. 4. Why throttle CPU and network while profiling?

    Problems that are invisible on a fast machine appear when resources are limited.

Summary

  • Profile with a clean, throttled setup and write down the conditions.
  • Network waterfall finds late, large and chained requests; the flame chart finds main-thread cost.
  • Break interaction latency into input delay, processing and presentation.
  • Change one thing, re-record and compare medians.

Next: Synthetic Monitoring and Alerts