Performance Traces, Style Recalculation, and Runtime Bottleneck Analysis
How to record DevTools performance traces, read flame charts and Selector Stats, and use Performance Insights for style and layout bottlenecks.
This page summarizes Chrome DevTools documentation on the Performance panel: recording traces while a page runs or loads, finding main-thread and rendering bottlenecks, and—when style work is expensive—using Selector Stats and related Performance Insights. Runtime performance is how the page behaves after load, as opposed to load performance; the Analyze runtime performance tutorial ties this work to the Response, Animation, and Idle phases of the RAIL model.
Performance panel: record a trace when the page feels slow
Section titled “Performance panel: record a trace when the page feels slow”The Performance panel records CPU performance profiles of web applications so you can find bottlenecks and optimize resource use. When you open it, the Live Metrics screen shows local Core Web Vitals—Largest Contentful Paint (LCP), Cumulative Layout Shift (CLS), and, as you interact, Interaction to Next Paint (INP)—so you can spot issues before you commit to a full trace.
Runtime performance is how your page performs when it is running, as opposed to loading.
— Google, Analyze runtime performance
Runtime recording vs load recording
Section titled “Runtime recording vs load recording”Use Record while you interact with the page when you care about jank, input delay, or animations after load. For initial navigation, use Start profiling and reload page so DevTools clears prior state, reloads, and stops shortly after load finishes. The Performance features reference describes both flows in detail.
For a reproducible runtime check, Google’s tutorial recommends Chrome Incognito (fewer extensions), then record several seconds of the scenario you want to improve and stop. Optional Screenshots in capture settings help you scrub the timeline and correlate UI state with expensive frames.
Flame chart and FPS: find what blocked smooth frames
Section titled “Flame chart and FPS: find what blocked smooth frames”After you stop a recording, the FPS chart shows when frame rate dropped low enough to hurt experience; red bars above FPS mark those moments. The CPU chart’s colors match the Summary tab—when CPU stays maxed, the goal is to do less work on the main thread.
The Main track flame chart maps time on the x-axis and the call stack on the y-axis; wider bars mean longer events. Purple events are rendering work; yellow is scripting. A red triangle on a Task marks a long task (warning). Select Animation Frame Fired, follow Initiated by links, and inspect child Layout events to spot forced synchronous layouts—for example JavaScript that changes styles then reads geometry every frame.
The main metric for measuring the performance of any animation is frames per second (FPS). Users are happy when animations run at 60 FPS.
— Google, Analyze runtime performance
Bottom-up and call tree views
Section titled “Bottom-up and call tree views”You do not have to read the flame chart alone. The Bottom-up tab aggregates where time was spent directly; the Call tree tab shows root activities and nested stacks. Sort by Self Time or Total Time to rank bottlenecks—the same approach described for diagnosing heavy CPU use in Understand Chrome’s Heavy Ad Interventions. The Timeline event reference explains event types such as Recalculate style, Layout, and Paint.
Recalculate Style events and Enable CSS selector stats
Section titled “Recalculate Style events and Enable CSS selector stats”Recalculate style (style recalculation) is Blink recomputing which styles apply after invalidation. Long recalculations often involve many elements or expensive selector matching. To see per-selector cost during long Recalculate Style events, enable selector statistics before you record.
To view the statistics of your CSS rule selectors during long-running Recalculate Style events, record a performance trace with the Selector Stats capture setting turned on.
— Google, Analyze CSS selector performance during Recalculate Style events
In Capture settings, check Enable CSS selector stats (documented in Enable CSS selector stats). The CSS selector costs insight notes this setting must be on for that insight in DevTools; collection has a performance cost, and the insight is informational (it always passes) and is not available in PageSpeed Insights.
Selector Stats tab columns
Section titled “Selector Stats tab columns”Click a Recalculate Style event in the trace, then open the Selector Stats tab. The table includes:
| Column | Meaning |
|---|---|
| Elapsed (ms) | Time spent matching this selector |
| Match Attempts | Elements the engine tried to match |
| Match Count | Elements that actually matched |
| % of slow-path non-matches | Share of attempts that missed and used a less optimized matching path |
| Selector | The CSS selector |
| Style Sheet | Source stylesheet |
Sort by Elapsed (ms) to rank the slowest selectors. For several events, right-click the table and Copy table into a spreadsheet, or double-click the CPU chart to select the full recording range and view aggregate totals in a summary row at the top of Selector Stats—both workflows are in Analyze CSS selector performance during Recalculate Style events.
Which selectors to fix first
Section titled “Which selectors to fix first”Google recommends focusing on selectors that combine high Elapsed (ms), high Match Attempts, low Match Count relative to attempts, and high % of slow-path non-matches—patterns that suggest the engine is doing expensive work for rules that rarely apply.
Try to change your CSS selectors so they require less time to calculate and match fewer elements on the page.
— Google, Analyze CSS selector performance during Recalculate Style events
Broader guidance from CSS selector costs: simpler selectors, fewer rules, a smaller and shallower DOM all reduce matching cost. The Optimize DOM size insight fails when style recalculation affects more than 300 elements or layout exceeds thresholds; on failure it highlights those events in the flame chart and points you to selector measurement and DOM depth reduction.
Performance Insights tab: forced reflow, DOM size, layout shifts
Section titled “Performance Insights tab: forced reflow, DOM size, layout shifts”After recording, open the Insights sidebar in the Performance panel (not the deprecated standalone Performance insights panel removed from Chrome 132—see Performance insights). Insights mirror many Performance Insights audits used in Lighthouse and link into the trace when you click an item.
Useful overlapping issues in this cluster:
- Forced reflow — JavaScript reads geometric properties after style invalidation, forcing immediate layout; repeated cases are layout thrashing.
- Layout shift culprits — unexpected movement without user input; the Layout shifts track groups shifts into clusters for CLS debugging.
- Optimize DOM size — large DOM increases style and layout cost even when depth alone is not the root problem.
The panel also surfaces LCP/INP subparts, third parties, and duplication issues; see Get actionable insights for the full workflow.
Rendering tab, Performance monitor, and sharing traces
Section titled “Rendering tab, Performance monitor, and sharing traces”For live rendering clues without a full trace, the Rendering tools include Paint flashing (repaint regions), Layout shift regions, and Frame rendering stats (real-time FPS and dropped frames). The Performance monitor graphs CPU, heap, DOM node count, and layouts or style recalculations per second while you navigate—useful for spotting layout thrashing while scrolling.
To collaborate, annotate items and time ranges, then save performance traces with optional script content and source maps for richer flame-chart debugging. The Recorder panel can replay a user flow and open a Performance trace automatically for flows such as checkout.
Optional custom tracks via console.timeStamp or performance.mark / performance.measure with a devtools detail object are documented in Customize your performance data with extensibility API; enable Show custom tracks in capture settings to see them.
Common mistakes
Section titled “Common mistakes”- Leaving Enable CSS selector stats on during ordinary profiling and mistaking added overhead for a production regression.
- Profiling only load when the bug appears during scroll, typing, or animation—record runtime while reproducing the exact interaction.
- Ignoring Match Count vs Match Attempts and optimizing selectors that already match efficiently.
- Treating the removed Performance insights panel as current; use Performance → Insights instead.
How to check this on your site
Section titled “How to check this on your site”- Open your page in Chrome, open DevTools → Performance, and confirm Live Metrics for LCP, CLS, and INP match what users report locally (Performance panel overview).
- Record a runtime trace while reproducing sluggish UI; inspect FPS dips, the Main flame chart, and Summary rendering vs scripting time (Analyze runtime performance).
- If Recalculate Style is large, enable Enable CSS selector stats, re-record, and sort Selector Stats by Elapsed (ms) (Analyze CSS selector performance during Recalculate Style events).
- Review failed items under Insights after the trace (Performance Insights) and cross-check layout behavior with Layout shifts on the timeline (Performance features reference).
- You can check automatically in Answerwell (our tool): https://answerwell.org/workspace
Report an error or ask a question
Section titled “Report an error or ask a question”If something on this page is wrong or unclear, email yimasynthetic@gmail.com with the page URL and the exact statement you are asking about so it can be corrected or explained.