Closed Bug 1436275 Opened 6 years ago Closed 1 year ago

High CPU usage and jerky scrolling on Windows 7 64-bit with ScrollAnywhere add-on

Categories

(Core :: DOM: Core & HTML, enhancement, P3)

x86_64
Windows 7
enhancement

Tracking

()

RESOLVED WORKSFORME

People

(Reporter: zbraniecki, Unassigned)

References

Details

I'm filing it based on the profile data and descriptions submitted on reddit: https://www.reddit.com/r/firefox/comments/7knnn4/firefox_quantum_is_eating_your_cpu_help_us_debug/dt86jbf/

(the user originally thought the issue was not present in 57, but then verified again and confirmed that it was present both in 57 and in 58)

Quoting the user (edited to include 57):

```
Firefox 57/58 has jerky scrolling for me.

It's most noticeable when trying to scroll while activating the window (or another tab) at the same time, with this extension. There's a very noticeable delay between when I click+drag (to activate and scroll) to when it actually starts scrolling - this is always reproducible for me. And when using the "momentum" feature of that addon, the scrolling is not smooth.
```

System specs:

CPU: AMD Phenom II 965 BE (quad core, 3.4 GhZ)
GPU: ASUS GeForce GTX 1060 Turbo 6GB GDDR5
Windows 7 64-bit

Profile: https://perfht.ml/2nfwsRi

Description: The first half of the capture is where it was the most noticeable... It's on this page - https://discourse.mozilla.org/t/why-does-firefox-developer-edition-exist-as-a-separate-edition/21347 , which seems to be doing something with scroll events? What I was doing there is clicking the taskbar (Windows 7) to deactivate Firefox, and then clicking&dragging inside Firefox (=activate+scrollAnywhere). But it's sometimes just as bad even on pages that don't use scroll events - even on pages where I've completely blocked JS. (Does JS even have scroll-events? I'm not much of a web developer.)

The second half of the capture is doing the same, but on the reddit comments page, where it was less noticeable, but still there.

I think the issue with stuttering while using scrollAnywhere's "momentum" feature is a separate issue - it's basically always noticeable in FF 58 (even when the activation-delay issue isn't happening), and it feels like micro-stuttering (frame-skipping) in video games. There should be enough scrolling in the captured profile to tell that it's there.

==========
Florian - can you take a look at the profile and NI the right people? Thank you!
Flags: needinfo?(florian)
The main thread seems to be unresponsive for 150-200ms each time the window is activated or deactivated. Almost all of this time is spent flushing styles (this actually used to be a full layout flush before we changed it to a style flush in bug 1369140).

Spending ~100ms to react when the user clicks a window to activate it is usually not perceived, but here when dragging the expectation is a smooth 60fps animation (so we can't block the main thread more than 16ms without it being felt).

Emilio, is the switch to stylo for chrome expected to help with this case? And if not, is it possible to optimize the window activation case to not restyle the whole window?
Flags: needinfo?(florian) → needinfo?(emilio)
Yes, that's exactly what I implemented in bug 1409672 :).
Depends on: 1409672, stylo-chrome
Flags: needinfo?(emilio)
Component: Untriaged → DOM
OS: Unspecified → Linux
Product: Firefox → Core
Hardware: Unspecified → x86_64
OS: Linux → Windows 7
Now the dependencies are fixed, is this still a problem?
Flags: needinfo?(gandalf)
The feedback I got from the reporter after he tested again is:

```
It seems that the devs focused only on the window-activation delay issue? As I said before - that issue seems to be gone in Nightly.

But the stuttering that happens during regular scrolling (not when activating+scrolling) is still very noticeable. Could you please ask them if they've looked into this as well?
```
Flags: needinfo?(gandalf)
(In reply to Zibi Braniecki [:gandalf][:zibi] from comment #5)
> The feedback I got from the reporter after he tested again is:
> 
> ```
> It seems that the devs focused only on the window-activation delay issue? As
> I said before - that issue seems to be gone in Nightly.
> 
> But the stuttering that happens during regular scrolling (not when
> activating+scrolling) is still very noticeable. Could you please ask them if
> they've looked into this as well?
> ```

Is there a new profile to look at? Bug 1441324 could help a bit with scrolling, but that was from the profiles we had in bug 1432858.
P3 since the behavior requires an add-on to show up (per comments; I didn't try the add-on).

Why is this in the DOM component?
Priority: -- → P3
Summary: High CPU usage and jerky scrolling on Windows 7 64-bit → High CPU usage and jerky scrolling on Windows 7 64-bit with ScrollAnywhere add-on
Component: DOM → DOM: Core & HTML
Severity: normal → S3

Danny, TCW, can you reproduce the scrolling problem when using https://addons.thunderbird.net/en-US/thunderbird/addon/scroll_anywhere/ ?

Flags: needinfo?(thee.chicago.wolf)
Flags: needinfo?(dannyfox)

(In reply to Wayne Mery (:wsmwk) from comment #8)

Danny, TCW, can you reproduce the scrolling problem when using https://addons.thunderbird.net/en-US/thunderbird/addon/scroll_anywhere/ ?

I cannot repro using 109.0b2 & Win 10. With the add-on installed, holding the middle mouse button / scroll wheel down and moving the mouse up and down scrolls smoothly when viewing the 6 or so emails I tested with. All emails were a mix of text or text with images.

Flags: needinfo?(thee.chicago.wolf)

Thanks TCW.

Status: NEW → RESOLVED
Closed: 1 year ago
Flags: needinfo?(dannyfox)
Resolution: --- → WORKSFORME
You need to log in before you can comment on or make changes to this bug.