New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 657009 link

Starred by 5 users

Issue metadata

Status: Assigned
Owner:
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Windows
Pri: 2
Type: Bug



Sign in to add a comment

Task manager can spend 20% of a core on drawing itself if you have many tabs

Project Member Reported by brat...@opera.com, Oct 18 2016

Issue description

Looking 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.

 
Labels: -Performance -Pri-3 Performance-Responsiveness Performance-Browser Needs-Investigation Pri-2
Status: Available (was: Untriaged)
This seems bad. Can you attach a trace from chrome://tracing?

Comment 2 by brat...@opera.com, Jun 19 2017

Labels: -OS-Windows -Pri-2 OS-Mac Pri-3
The problem is the Elide calls. Supposedly never designed to be used for a lot of fields.

Comment 3 by nick@chromium.org, Jun 19 2017

Cc: a...@chromium.org
If this is mac-specific, maybe avi has thoughts.

Comment 4 by a...@chromium.org, 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.

Comment 5 by brat...@opera.com, Jun 19 2017

Labels: OS-Windows
It was on Windows. I didn't consider that the code could be different on different operating systems. 

Comment 6 by a...@chromium.org, Jun 19 2017

Labels: -OS-Mac
I'm taking off the "Mac" tag, as the Mac and Views Task Managers do not share code.

Comment 7 by a...@chromium.org, Jun 19 2017

... do not share UI code. (They share the backend code, but that's not what this is about.)

Comment 8 by nick@chromium.org, Jun 19 2017

Labels: -Pri-3 Pri-2
Project Member

Comment 9 by sheriffbot@chromium.org, Jun 20 2018

Labels: Hotlist-Recharge-Cold
Status: Untriaged (was: Available)
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
Cc: brucedaw...@chromium.org
Possibly the same underlying problem as  issue 737304 . Whaddya think, brucedawson?
It sounds similar indeed.
Owner: brucedaw...@chromium.org
Status: Assigned (was: Untriaged)
Assigning to brucedawson@, current primary for Chrome Power, to triage further.
Owner: davidbienvenu@chromium.org
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.

Labels: Hotlist-DesktopUIChecked Hotlist-DesktopUIToolingRequired
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.
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.
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