Closed Bug 1679645 Opened 4 years ago Closed 4 years ago

Rendering long pages with text selection takes seconds

Categories

(Core :: Web Painting, defect, P2)

Firefox 85
Unspecified
All
defect

Tracking

()

VERIFIED FIXED
89 Branch
Tracking Status
firefox-esr78 --- wontfix
firefox86 --- wontfix
firefox87 --- wontfix
firefox88 --- wontfix
firefox89 --- verified
firefox90 --- verified

People

(Reporter: paulkek, Assigned: mikokm)

References

(Regression)

Details

(Keywords: perf, regression, reproducible)

Attachments

(1 file)

User Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.66 Safari/537.36

Steps to reproduce:

Hardware:

  • i7-6700k (4/8 cores with Intel HD Graphics 530)
  • 32GB DDR4 RAM
  • Linux 5.9.11-arch2-1
  • Xorg / GNOME 3.38
  • Mesa 20.2.3-1
  • Firefox Nigthly 85.0a1 (2020-11-28) (64-bit) with no extensions

layers.acceleration.force-enabled: true

Tested with both WebRender enabled and disabled.

Reproduction:

Actual results:

The page takes a while to actually show the page (~2 seconds).

Expected results:

Without text selection, the page renders promptly so should it with text selection.

Setting a component for this enhancement in order to get the dev team involved.
If you feel it's an incorrect one please feel free to change it to a more appropriate one.

Component: Untriaged → Widget: Gtk
Product: Firefox → Core

Can you use gecko profiler (https://profiler.firefox.com/) to find the weak spot?
Thanks.

Flags: needinfo?(paulkek)

I can reproduce the issue on Nightly85.0a1 Windows10 if some code is selected.

Without text selection: https://share.firefox.dev/2Ig4uCO

With text selection: https://share.firefox.dev/36Ld5H1

Status: UNCONFIRMED → NEW
Has STR: --- → yes
Component: Widget: Gtk → Web Painting
Ever confirmed: true
Keywords: perf, reproducible
OS: Unspecified → All
Type: enhancement → defect

I can still reproduce this. Ping?

Flags: needinfo?(paulkek)

Ping. I can still reproduce this issue with the latest nightly.

Assignee: nobody → mikokm
Status: NEW → ASSIGNED

This patch does not fix the root cause of the issue, which is described in bug 1503581.
What this patch does fix, is that we now reuse the results of the expensive computation at least until the text frame is reflowed, or if the selection changes.

Severity: -- → S2
Priority: -- → P2

Hi,
As per comment 4 I will update "has regression range" field accordingly.
Best,
Clara

Has Regression Range: --- → yes
Attachment #9209484 - Attachment description: Bug 1679645 - Cache the selection state in nsTextFrame r=emilio → Bug 1679645 - Cache the selection state in nsTextFrame rather than in nsDisplayText r=emilio
Pushed by mikokm@gmail.com: https://hg.mozilla.org/integration/autoland/rev/01519685a650 Cache the selection state in nsTextFrame rather than in nsDisplayText r=emilio
Flags: needinfo?(mikokm)
Flags: needinfo?(mikokm)
Pushed by mikokm@gmail.com: https://hg.mozilla.org/integration/autoland/rev/ced7356760f0 Cache the selection state in nsTextFrame rather than in nsDisplayText r=emilio,jfkthame
Status: ASSIGNED → RESOLVED
Closed: 4 years ago
Resolution: --- → FIXED
Target Milestone: --- → 89 Branch
Flags: qe-verify+

I was able to reproduce this issue on Firefox 85.0a1 (2020-11-28) on macOS 10.15.7.

Tried verifying it on Firefox 89.0b9 and Firefox 90.0a1 but it seems to be still reproducing (see attachment). Is there something that can be done?

Flags: needinfo?(mikokm)

(In reply to Catalin Sasca, QA [:csasca] from comment #14)

I was able to reproduce this issue on Firefox 85.0a1 (2020-11-28) on macOS 10.15.7.

Tried verifying it on Firefox 89.0b9 and Firefox 90.0a1 but it seems to be still reproducing (see attachment). Is there something that can be done?

I think what you are observing is correct. As mentioned in the comment 8, this patch only mitigates the problem. The root cause of this issue is tracked in bug 1503581.

Do you see any improvement with newer Firefox? The content should reappear much quicker now after scrolling.

On this page, we call the slow nsTextFrame::IsFrameSelected() function almost ten thousands times per page scrolled (and multiple times per frame). Based on casual testing, this patch caches around 90-95% of those calls.

Flags: needinfo?(mikokm)

Yes, the performance is a bit better (~1 second) to display the text. Reverified on Firefox 89.0b10 and 90.0a1 (2021-05-09) under macOS 10.15.7, Ubuntu 20.04 and Windows 10.

Status: RESOLVED → VERIFIED
Flags: qe-verify+
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: