From da7214c4ae113ee74b7a600720b178cb4155d987 Mon Sep 17 00:00:00 2001 From: Markus Stange Date: Sat, 7 Mar 2026 10:34:50 -0500 Subject: [PATCH 1/4] Move special handling of inverted roots. Instead of not computing the information in getTimingsForCallNodeIndex, compute the information anyway but then choose to not display it in the various places where we display call node timings. This allows the computation code to be more consistent, which will make future optimizations easier to reason about because all paths now call into accumulateDataToTimings. --- src/components/sidebar/CallTreeSidebar.tsx | 6 +- src/components/tooltip/CallNode.tsx | 8 +- src/profile-logic/profile-data.ts | 21 ++++-- .../__snapshots__/profile-view.test.ts.snap | 1 + src/test/store/profile-view.test.ts | 73 ++++++++++--------- 5 files changed, 64 insertions(+), 45 deletions(-) diff --git a/src/components/sidebar/CallTreeSidebar.tsx b/src/components/sidebar/CallTreeSidebar.tsx index e93028c5a0..fe03d9dc5a 100644 --- a/src/components/sidebar/CallTreeSidebar.tsx +++ b/src/components/sidebar/CallTreeSidebar.tsx @@ -299,7 +299,11 @@ class CallTreeSidebarImpl extends React.PureComponent { const totalTimePercent = Math.round((totalTime.value / rootTime) * 100); const selfTimePercent = Math.round((selfTime.value / rootTime) * 100); const totalTimeBreakdownByCategory = totalTime.breakdownByCategory; - const selfTimeBreakdownByCategory = selfTime.breakdownByCategory; + // For inverted root nodes, self === total, so showing a separate self + // breakdown would be redundant. + const selfTimeBreakdownByCategory = timings.isInvertedRoot + ? null + : selfTime.breakdownByCategory; return (