Closed Bug 1890358 Opened 2 years ago Closed 2 years ago

Tab freezes while viewing GitHub PR changes

Categories

(Core :: Disability Access APIs, defect, P2)

Firefox 126
ARM64
macOS
defect

Tracking

()

RESOLVED WORKSFORME

People

(Reporter: claas, Unassigned)

Details

I looked at https://github.com/mdn/data/pull/719/files and clicked on "Load diff..." when the tab started to freeze and I could no longer click any element on the web page nor reload the page with CTRL + R.

While this happened, I captured the following profile, and the tab got responsive again after a minute or so: https://share.firefox.dev/3PVzB6a

The Bugbug bot thinks this bug should belong to the 'Core::CSS Parsing and Computation' component, and is moving the bug to that component. Please correct in case you think the bot is wrong.

Component: Untriaged → CSS Parsing and Computation
Product: Firefox → Core

Seeing lots of accessibility in that profile

Component: CSS Parsing and Computation → Disability Access APIs
OS: Unspecified → macOS
Hardware: Unspecified → ARM64
Version: unspecified → Firefox 126

This looks like we are choking up when constructing the cache after tree mutations. The hot spot seems to be TextLeafPoint::FindNextLineStartSameLocalAcc and the time is spent almost exclusively in nsTextFrame::GetRenderedText.

Jamie, if nothing immediately comes to mind I can spend some time on this too.

Severity: -- → S2
Flags: needinfo?(jteh)
Priority: -- → P2

Nothing comes to mind immediately. The changes in bug 1770981 should mean that we use a line cursor when calling GetRenderedText. As long as we're mostly walking the tree in content order, GetRenderedText should be relatively efficient. Because mutation events are stored in a linked list, this should mostly be in content order... unless the page is adding nodes in random order, but that seems highly unlikely.

If you have some cycles to look at this, that'd be awesome.

Flags: needinfo?(jteh)

See also bug 1771060 and bug 1771579, which both relate to keeping things in order to ensure we get maximum benefit from the line cursor, but I doubt they're relevant here because they aren't related to mutation events (which are already ordered).

:claas, I can't reproduce this. Loading the diff happens within a second for me. Did this particular diff get smaller due to a PR update? Can you still reproduce this?

Flags: needinfo?(caugner)

I've tried to reproduce this a bunch of times with no luck. Tested on Windows since I don't have a Mac, though I haven't noticed anything in the profile that points to a platform-specific issue. I agree with Eitan's analysis of the profile.

Did this particular diff get smaller due to a PR update?

FWIW, it doesn't look to me like there's any significant difference in size between commits on this PR. I couldn't reproduce it on the first commit alone, either.

I can't reproduce this on macOS either :(

I guess something changed here and this is now fixed, so I'm going to close this. If the problem persists, please reopen.

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