CPU Profiling and Bottom-Up View
You'll learn how to use DevTools views to identify which functions hog the most CPU time.
When your app feels sluggish or unresponsive, the culprit is often JavaScript consuming too much CPU time. DevTools offers specialized views—bottom-up and call tree—to help you pinpoint exactly which functions are the performance bottlenecks.
How These Views Work
After recording a performance profile, you can switch between different analysis views:
Call Tree View: Shows the execution flow from top-level functions down to nested calls. It's like tracing a path from the entry point through each function called.
Bottom-Up View: Flips the perspective—it groups time by the leaf functions (the ones doing the actual work) regardless of how they were called. This view answers: "Which individual functions consumed the most CPU time?"
Think of it like analyzing restaurant orders. The call tree shows "Customer ordered meal → which included appetizer → which required chopping onions." The bottom-up view says "Chopping onions took 45 minutes total across all meals, regardless of which dishes needed it."
Why Bottom-Up Matters
The bottom-up view is incredibly powerful for optimization because it reveals the self time—how much CPU each function itself used, not including its children. A function might appear briefly in the call tree but actually consume massive CPU when you see all its invocations aggregated in bottom-up view.
You'll typically sort by "Self Time" or "Total Time" columns to identify the heaviest functions, then investigate why they're being called so frequently or taking so long.
Key Takeaway: Use the bottom-up view to quickly spot which functions consume the most CPU by aggregating all their executions, then use the call tree to understand how and why those functions are being invoked.