Open Bug 1647942 Opened 4 years ago Updated 3 years ago

Performance of 'view source' on extremely long lines is unacceptable

Categories

(Toolkit :: View Source, defect, P2)

77 Branch
Desktop
All
defect

Tracking

()

Tracking Status
firefox77 --- affected
firefox78 --- affected
firefox79 --- affected

People

(Reporter: kanepyork, Unassigned)

Details

User Agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:77.0) Gecko/20100101 Firefox/77.0

Steps to reproduce:

  1. Go to any Discourse forum (e.g. meta.discourse.org, try.discourse.org)
  2. View Source / Ctrl-U
  3. Suffer

Actual results:

Anonymous view on Try performed a first paint almost immediately, then took ~5 seconds to do anything else other than scrolling. Logged-in view on Meta rendered after several minutes.

While the page is rendering, the page we are viewing the source of is not interactive.

Expected results:

"View Source" completes in time linear to the size of the page source in bytes, regardless of any potentially problematic features in the text, just like any other text rendering.

Hello I managed to reproduce the issue on Ubuntu 18.04 LTS using Firefox Nightly 79.0a1 (2020-06-29) and also Fx 78.0b9 and Fx 77.0.1.

Will set a component for this issue so one of our developers could look more into it, if it's not the right component please feel free to change it to an appropriate one.

Could you please provide a memory report from about:memory?

Status: UNCONFIRMED → NEW
Component: Untriaged → View Source
Ever confirmed: true
Flags: needinfo?(kanepyork)
OS: Unspecified → All
Product: Firefox → Toolkit
Hardware: Unspecified → Desktop

Note: It appears this is due to multiple kilobytes of JSON data being rendered in an HTML attribute with full escaping.

Flags: needinfo?(kanepyork)

The severity field is not set for this bug.
:Honza, could you have a look please?

For more information, please visit auto_nag documentation.

Flags: needinfo?(odvarko)

I am able to reproduce the problem on my machine.
Showing the source view for:
https://discourse.mozilla.org/c/devtools?utm_source=devtools&utm_medium=tabbar-menu
...never finishes.

I am attaching a perf profile showing how memory consumption steadily increases.
https://share.firefox.dev/2Osp5U3

Honza

Severity: -- → S3
Has STR: --- → yes
Flags: needinfo?(odvarko)
Priority: -- → P2

The performance in general has regressed between 73 and 78 (which are the two browser versions I happen to have installed). There's a PR to replace the preloaded data as an attribute to a javascript variable https://github.com/discourse/discourse/pull/10129

Ah, my experience is because I'm running noscript (even with all the scripts enabled).

Bump - people are sending us reports that View Source is completely broken in Firefox.

I can’t see the “page source” anymore! Ctrl+U (Firefox) just shows an empty page

it work (for me at least), it just takes a loooooong time

https://forum.arduino.cc/t/do-you-like-the-new-forum/847695/824

Summary: Performance of 'view source' on Discourse forums is unacceptable → Performance of 'view source' on extremely long lines is unacceptable

(In reply to Jan Honza Odvarko [:Honza] (always need-info? me) from comment #4)

I am able to reproduce the problem on my machine.
Showing the source view for:
https://discourse.mozilla.org/c/devtools?utm_source=devtools&utm_medium=tabbar-menu
...never finishes.

I am attaching a perf profile showing how memory consumption steadily increases.
https://share.firefox.dev/2Osp5U3

Honza

I tried that URL and it took around 30 seconds to show some text source; FF used around 50MB of RAM for 346kB of HTML code which it looks like a bit too much considering that there are lots of web pages with 1MB .. 2MB of HTML code.

There is something wrong in view source code handling, it looks like its behavior has regressed in last few years.

(In reply to A.D.F. from comment #8)

(In reply to Jan Honza Odvarko [:Honza] (always need-info? me) from comment #4)

I am able to reproduce the problem on my machine.
Showing the source view for:
https://discourse.mozilla.org/c/devtools?utm_source=devtools&utm_medium=tabbar-menu
...never finishes.

I am attaching a perf profile showing how memory consumption steadily increases.
https://share.firefox.dev/2Osp5U3

Honza

I tried that URL and it took around 30 seconds to show some text source; FF used around 50MB of RAM for 346kB of HTML code which it looks like a bit too much considering that there are lots of web pages with 1MB .. 2MB of HTML code.

There is something wrong in view source code handling, it looks like its behavior has regressed in last few years.

Firefox 94.0.1 64 bit, Windows 10 64 bit, 6GB RAM, Firefox was the only application running when I tried above operation.

I also tried above mentioned URL: https://forum.arduino.cc/t/do-you-like-the-new-forum/847695/824

I scrolled down the dynamic document till the end of it (around 2000 comments / replies) and then opened "View source".

It took 70 seconds to complete the operation and it required 80MB of RAM while Firefox was consuming 32%..34% of CPU time (a very fast CPU 64 bit).

Yes, I can confirm that "View source" function is really broken in some parts of it.

(In reply to kanepyork from comment #2)

Note: It appears this is due to multiple kilobytes of JSON data being rendered in an HTML attribute with full escaping.

I apologize, this was not fully clear: I highly suspect that there is an issue in the line-wrapping algorithm. The above mentioned several kilobytes are all on the same source line.

You need to log in before you can comment on or make changes to this bug.