Bug 237118 - live.com uses a lot of CPU whenever the window loses / gains focus
Summary: live.com uses a lot of CPU whenever the window loses / gains focus
Status: ASSIGNED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Layout and Rendering (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Chris Dumez
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2022-02-23 15:47 PST by Chris Dumez
Modified: 2022-06-23 15:41 PDT (History)
6 users (show)

See Also:


Attachments
Patch (11.24 KB, patch)
2022-02-23 15:53 PST, Chris Dumez
ews-feeder: commit-queue-
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Chris Dumez 2022-02-23 15:47:31 PST
live.com uses a lot of CPU whenever the window loses / gains focus.
Comment 1 Chris Dumez 2022-02-23 15:53:15 PST
Created attachment 453038 [details]
Patch
Comment 2 Simon Fraser (smfr) 2022-02-23 16:09:34 PST
I'm concerned that we're optimizing for a one-time paint on window activation/deactivation as opposed to a continual 10% background CPU usage, which we saw on some pages when fixing bug 167997.
Comment 3 Chris Dumez 2022-02-23 16:16:36 PST
(In reply to Simon Fraser (smfr) from comment #2)
> I'm concerned that we're optimizing for a one-time paint on window
> activation/deactivation as opposed to a continual 10% background CPU usage,
> which we saw on some pages when fixing bug 167997.

I agree it is not ideal.

My thinking was that focusing / unfocusing windows is a lot more common than this corner case where:
1. The Safari window is only partially visible
2. The part that is visible is being repainted BUT doesn't visually changes due to large tiles
3. The page is using a lot of CPU due to timers

I think ideally, we'd make it a lot cheaper to repaint this page. However, this is not something I know how to do, which is why I proposed this as a mitigation.
Comment 4 Geoffrey Garen 2022-02-23 20:10:21 PST
What if we make the tile size smaller if and only if we are a foreground tab in a non-foreground window and we find ourselves (re-)painting frequently? -- at first glance, that would seem to be the best of both worlds.
Comment 5 Simon Fraser (smfr) 2022-02-23 20:24:46 PST
Rather than complicate the tiling logic, I'd prefer to just minimize the cost of the blur.
Comment 6 Geoffrey Garen 2022-02-23 20:37:20 PST
(In reply to Simon Fraser (smfr) from comment #5)
> Rather than complicate the tiling logic, I'd prefer to just minimize the
> cost of the blur.

Do we have a way to do that?
Comment 7 Simon Fraser (smfr) 2022-02-23 20:48:50 PST
Options:
1. in this particular case only blur the non-clipped part of the content
2. get CoreImage filters working
3. make the blurred element a compositing layer, in which case we'll let CA do the blur (but with possible knock-on effects triggering more compositing layers)
Comment 8 Geoffrey Garen 2022-02-23 21:26:12 PST
Are we sure that a clipped blur is the only case where we expect painting to be expensive?
Comment 9 Simon Fraser (smfr) 2022-02-23 21:29:46 PST
Blurs in general are expensive to compute, which we do at paint time (when not composited). Other things are too, but non-composited filters are one of the more common causes of expensive painting.
Comment 10 Radar WebKit Bug Importer 2022-03-02 15:48:17 PST
<rdar://problem/89717354>
Comment 11 Brent Fulgham 2022-06-23 15:41:30 PDT
This appears to actually be tracked by:
rdar://89029702