Closed Bug 1712780 Opened 3 years ago Closed 3 years ago

Page becomes unresponsive while loading an svg with a lot of nodes

Categories

(Core :: SVG, defect, P2)

Firefox 90
Desktop
All
defect

Tracking

()

RESOLVED FIXED
95 Branch
Webcompat Priority ?
Performance Impact medium
Tracking Status
firefox-esr78 --- unaffected
firefox-esr91 --- wontfix
firefox88 --- wontfix
firefox89 --- wontfix
firefox90 --- wontfix
firefox91 --- wontfix
firefox92 --- wontfix
firefox93 --- wontfix
firefox94 --- wontfix
firefox95 --- fixed

People

(Reporter: ksenia, Assigned: jfkthame)

References

(Regression, )

Details

(Keywords: perf:pageload, regression)

Attachments

(1 file)

This was initially reported in https://github.com/webcompat/web-bugs/issues/73237

STR:

  1. Visit https://github.com/tokio-rs/console if Firefox Nightly 90 (2021-05-25), scroll down to "extremely cool and amazing demo" title and observe the page

Actual:
Page becomes unresponsive, bottom half of the page is not loaded until the svg loads

Expected:
Page is responsive and contents are loaded

The reporter is experiencing the issue on Windows, but I also can reproduce it on Mac.

Performance profile: https://share.firefox.dev/33BjEtr

The link to the svg (the issue is not reproducible when there is only svg on the page): https://camo.githubusercontent.com/e6b2a4f6fe2d2503477539667ab0c80c1ba93e5c6c31fd2d2b735aef13d7d184/68747470733a2f2f61736369696e656d612e6f72672f612f3431323133392e737667

Hi Chris, looks like this is related to 1697865, would you be able to take a look?

Flags: needinfo?(cmartin)

Thanks Alice. I run mozregression on Windows and get the same window as you. Still getting the original window on Mac :/

It seems like 1696792 is likely related to this, rather than 1697865, so I'll change the component

Has Regression Range: --- → yes
Component: Security: Process Sandboxing → SVG
Keywords: regression
Regressed by: 1696792
Flags: needinfo?(cmartin)

Set release status flags based on info from the regressing bug 1696792

Jonathan, can you look into this?

Flags: needinfo?(jfkthame)

Oof. The svg image appears to wrap every individual character of the "console" display in a separate tspan, with explicit x-coordinate positioning. We used to run them together into a single textrun, but we no longer do that (because of issues such as bug 1696792), so this now becomes really expensive as we do the whole line-breaking, text-shaping dance involved in text-frame layout separately for each one of them. We should see if we can optimize that somehow.

Flags: needinfo?(jfkthame)

Given that we know we'll be shaping each tspan independently, and won't be doing line-breaking, maybe we can have a simplified version of textrun creation for textframes that are part of SVG, and avoid some of the cost here.

Marking this as S3 as it's a fairly obscure use-case, I think, although the impact in this example is pretty bad.

Severity: -- → S3
Webcompat Priority: --- → ?
Whiteboard: [qf]
Type: defect → enhancement
Priority: -- → P2
Type: enhancement → defect

Hey :jfkthame,
We are increasing the priority to P2 because this is a breaking change. Do you know how we can move forward with this?

Flags: needinfo?(jfkthame)
Whiteboard: [qf] → [qf:p2:pageload]

The original page mentioned in comment 0 has changed so that it no longer exhibits this issue, but it can be reproduced easily with an example such as:

data:text/html,<img src="https://camo.githubusercontent.com/e6b2a4f6fe2d2503477539667ab0c80c1ba93e5c6c31fd2d2b735aef13d7d184/68747470733a2f2f61736369696e656d612e6f72672f612f3431323133392e737667">

which takes around 16s to reflow in Nightly on my MacBook.

Flags: needinfo?(jfkthame)

As we don't support multi-line text in SVG, there's no point running the line-breaker and
collecting potential break positions for textframes that are part of an SVG text subtree.
Telling BuildTextRunsScanner to skip this makes it somewhat less expensive.

In my local build, this reduces the reflow time of the testcase from nearly 20s to about 4.5s.
Still much too long, but at least it's a step in the right direction.

Assignee: nobody → jfkthame
Status: NEW → ASSIGNED
Pushed by jkew@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/4a265cea0290
Skip running the line-breaker when scanning SVG text frames. r=emilio
Status: ASSIGNED → RESOLVED
Closed: 3 years ago
Resolution: --- → FIXED
Target Milestone: --- → 95 Branch

Since the status are different for nightly and release, what's the status for beta?
For more information, please visit auto_nag documentation.

Regressions: 1738560
Regressions: 1756750
Performance Impact: --- → P2
Keywords: perf:pageload
Whiteboard: [qf:p2:pageload]
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: