Task manager can spend 20% of a core on drawing itself if you have many tabs |
|||||||||||
Issue descriptionLooking at a trace of the browser with many tabs open and the task manager open I found that 20% of the main thread is spent painting a TableView in 200ms chunks making the browser rather unresponsive. It seems like every line is rendered regardless of if it's visible or not and every line needs a lot of time to shape the tab titles. About half of the time is spent inside hundreds (thousands?) of calls to RenderTextHarfBuzz:EnsureLayoutRunList. In the trace the parent is View::Paint (class=TableView) directly or indirectly through RenderText::Elide. A RenderText::Elide call can take 1 millisecond. Measured in a slightly old Opera (using Chromium 53.0.2785.101) but I don't think the code has changed anything recently.
,
Jun 19 2017
The problem is the Elide calls. Supposedly never designed to be used for a lot of fields.
,
Jun 19 2017
If this is mac-specific, maybe avi has thoughts.
,
Jun 19 2017
I don't understand how this would be Mac. The class TableView and the call RenderTextHarfBuzz:EnsureLayoutRunList are Views-only, while the Mac Task Manager uses a native NSTableView. OP, can you clarify on what platform you're seeing this? Is this on Windows? Linux? Mac with the MacViews flag turned on? This doesn't make sense to me for the default Mac config that we ship.
,
Jun 19 2017
It was on Windows. I didn't consider that the code could be different on different operating systems.
,
Jun 19 2017
I'm taking off the "Mac" tag, as the Mac and Views Task Managers do not share code.
,
Jun 19 2017
... do not share UI code. (They share the backend code, but that's not what this is about.)
,
Jun 19 2017
,
Jun 20 2018
This issue has been Available for over a year. If it's no longer important or seems unlikely to be fixed, please consider closing it out. If it is important, please re-triage the issue. Sorry for the inconvenience if the bug really should have been left as Available. For more details visit https://www.chromium.org/issue-tracking/autotriage - Your friendly Sheriffbot
,
Nov 13
Possibly the same underlying problem as issue 737304 . Whaddya think, brucedawson?
,
Nov 13
It sounds similar indeed.
,
Nov 19
Assigning to brucedawson@, current primary for Chrome Power, to triage further.
,
Nov 19
Assigned to David. He'll figure out what is going on and what can be improved. Some of the fixes may be cross-platform. One possible change would be to move the task manager out-of-proc. This would solve the problem of it being impossible to use Chrome's task manager to see how much CPU time the browser process is using, in a way that no amount of optimization will ever do.
,
Nov 22
,
Dec 27
WPA turned out to be quite helpful here - DrawStringRectWithFlags is getting called much more often than expected. It turns out that we're trying to paint all rows, ignoring whether they're visible or not. TableView::GetPaintRegion is using the canvas getLocalClipBounds instead of the VisibleBounds of the view, when determining how many rows to paint. Using VisibleBounds seems to work for the taskmanager, but there are other clients of TableView that might not, I suppose. So I'll have to check with sky@ about the right way to fix this. It's also quite possible that we're painting more frequently than we need to, but definitely the low hanging fruit is to only paint the visible rows.
,
Dec 28
Excellent discovery. One caution however. You said "WPA turned out to be quite helpful here - DrawStringRectWithFlags is getting called much more often than expected" - but WPA doesn't tell you how often a function was called (usually). Specifically, CPU Usage (Sampled) shows you how many samples hit inside a function/call-stack, but it generally can't distinguish between one call to a slow function and many calls to a fast/medium function.
,
Dec 28
Ah, OK, good to know. In this case, this function is generally fast, but called frequently. FWIW, I turned on fast sampling, and used the CPU usage (precise) graph. |
|||||||||||
►
Sign in to add a comment |
|||||||||||
Comment 1 by benhenry@chromium.org
, Apr 26 2017Status: Available (was: Untriaged)