Closed Bug 320378 Opened 19 years ago Closed 17 years ago

[Firefox 1.5 and 2.x] Rendering of very simple pages takes over 20 seconds

Categories

(Core :: Layout: Floats, defect, P1)

defect

Tracking

()

RESOLVED FIXED

People

(Reporter: stefan-l, Assigned: roc)

References

Details

(Keywords: perf, regression, testcase, Whiteboard: [reflow-refactor])

Attachments

(5 files, 3 obsolete files)

User-Agent: Mozilla/5.0 (Macintosh; U; PPC Mac OS X; en) AppleWebKit/416.12 (KHTML, like Gecko) Safari/416.13 Build Identifier: Mozilla/5.0 (Macintosh; U; PPC Mac OS X Mach-O; en-US; rv:1.8) Gecko/20051111 Firefox/1.5 I attached a page showing the problem. Rendering the page, both on Mac OS X and on Windows, takes well over 20 seconds. On Firefox 1.0.7 the page is rendered instantaneous. I have isolated the issue: it is between the lines "START COMMENT OUT HERE" and "FINISH COMMENT OUT HERE" in the style sheet. Removing that part makes the page render instantaneous. (The layout is not as intended in that case, obviously.) Reproducible: Always Steps to Reproduce: 1. Extract the attached ZIP file 2. Load the page "example.html" in Firefox 1.5 Actual Results: Rendering the page takes over 20 seconds, both on Windows and on Mac OS X Expected Results: The page should render instantaneously, as it does in Firefox 1.0.7. I found a bug report that is probably not related to this, but I'm not sure, so I give you the bug ID: #319644. The reason that I set the severity to "major" is that this issue makes our CMS back-end unusable for Firefox 1.5 users.
Attached file Example page demonstrating the issue (deleted) —
Attached file testcase from reporter's attached .zip (obsolete) (deleted) —
Component: General → Layout
Keywords: testcase
Product: Firefox → Core
Version: unspecified → 1.8 Branch
QA Contact: general → layout
Attachment #205959 - Attachment is obsolete: true
Dupe of one of the many 'firefox slow tables' bugs?
I don't think so, because this is a non-table css only layout.
nested divs and tables don't behave much different (performance wise) Martijn, can you figure this one out ?
Attached file partly minimised testcase (deleted) —
Seems to be happening because of the floats and the use of lists.
With that regression range, it is very likely a regression from bug 209694.
Blocks: 209694
Status: UNCONFIRMED → NEW
Component: Layout → Layout: Floats
Ever confirmed: true
Keywords: regression
QA Contact: layout → layout.floats
Attached file minimised testcase (deleted) —
This renders slow for me (lags for 5 sec or so), while it is still pretty fast in Mozilla1.7.
Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9a1) Gecko/20051217 Firefox/1.6a1 ID:2005121705 It loads normally, but it maximizes slowly :)
(In reply to comment #11) > Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9a1) Gecko/20051217 > Firefox/1.6a1 ID:2005121705 > > It loads normally, but it maximizes slowly :) > You need a slow computer like Martijn (600MHz) and I(850MHz) have Ria ;-) It takes ~5 secs to display and a repaint after window resize is ~10 secs.
I don't know if it's relevant, but please note that in my original example I could not get it to work by using other constructs than float, such as position absolute (from the right of the screen), position relative, etc. (All my attempts tried to retain the intended layout. Just displaying the 'other' div and the divs inside that as 'inline' makes it render instantaneous again, but destroys the layout.)
Depends on: 273293
Blocks: 326085
Keywords: perf
Blocks: 203448
Flags: blocking1.9a1?
Using the latest trunk build is this still valid?
If you can direct me to a Mac OS X build of that version, I will be happy to test it... (In reply to comment #14) > Using the latest trunk build is this still valid?
(In reply to comment #14) > Using the latest trunk build is this still valid? Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9a1) Gecko/20060531 Minefield/3.0a1 ID:2006053104 [cairo] Going slower than ever with https://bugzilla.mozilla.org/attachment.cgi?id=205960 Rendering the test case takes 100% of CPU for 50 seconds running on Athlon XP 2800+! On the plus side, the test case displays incrementally. Even closing the tab that has the test case open takes about 10 seconds! Just tested the very same test case with Opera/9.00 (X11; Linux i686; U; en) and it has no problems with it.
I just wanted to point out that this bug has not been solved in Firefox 2.0 beta 1. Is the version field (currently '1.8 Branch') correct? Shouldn't this be 'trunk'?
Version: 1.8 Branch → Trunk
This is almost certainly a regression from bug 209694. For what it's worth, a trunk build loads the "minimised testcase" in 17 seconds, while a reflow branch build does so in 6. Which is still way too much...
So for the minimized testcase, I tried logging the times through the |while (PR_TRUE)| loop in nsBlockFrame::ReflowBlock. We hit the beginning of that loop 44463 for 186 distinct blocks; an average of 250 times a block. 84 blocks got reflown 512 times. 3 blocks got reflown 256 times. 2 blocks got reflown 128 times. 3 blocks got reflown 64 times. 2 blocks got reflown 32 times. 3 blocks got reflown 16 times. 3 blocks got reflown 8 times. 3 blocks got reflown 4 times. 2 blocks got reflown 3 times. 4 blocks got reflown 2 times. 77 blocks got reflown 1 time. Sadly, the "reflow counts" option in the layout debugger seems broken. :( So not sure which blocks we're reflowing that much.
So yeah... removing the margin-collapse retry makes this page render beautifully. Which makes sense -- the page has a set of deeply nested blocks each of which ends up needing the retry. So the time taken is exponential in the depth of the nesting. :( So this looks like a different issue from bug 273293, and one we should really try to deal with for Gecko 1.9, imo.
Whiteboard: [reflow-refactor]
After reflow branch has landed, I'll try to make the second-pass reflow more incremental so it doesn't have to reflow block children that haven't changed.
Flags: blocking1.9a1? → blocking1.9-
Whiteboard: [reflow-refactor] → [reflow-refactor][wanted-1.9]
(In reply to comment #21) > After reflow branch has landed, I'll try to make the second-pass reflow more > incremental so it doesn't have to reflow block children that haven't changed. In case you haven't noticed, the reflow branch has landed ;)
Attached patch proof of concept (obsolete) (deleted) — Splinter Review
This patch nails the performance problems completely, as far as I can tell. The idea is to abort reflow as soon as we detect that a second pass will be needed. I believe this reduces possible O(2^N) behaviour to O(N). However, this approach to aborting reflow is, at best, a huge hack. David, what do you think the right interface should be to allow Reflow() to abort this way? A magic rv, a new flag in nsHTMLReflowMetrics, or a new nsRelowStatus? And how specific should the abort signal be...
Assignee: nobody → roc
Status: NEW → ASSIGNED
Blocks: 364343
Summary: [Firefox 1.5] Rendering of very simple pages takes over 20 seconds → [Firefox 1.5 and 2.x] Rendering of very simple pages takes over 20 seconds
Attached patch Simplified version of proof of concept (obsolete) (deleted) — Splinter Review
It seems to me that we don't need another flag or special return; we already have aState.mReflowState.mDiscoveredClearance to indicate this situation.
Comment on attachment 273031 [details] [diff] [review] Simplified version of proof of concept Mmmmm ... yeah!!!
Attachment #273031 - Flags: superreview+
Attachment #273031 - Flags: review+
Assignee: roc → sharparrow1
Status: ASSIGNED → NEW
Checked in.
Status: NEW → RESOLVED
Closed: 17 years ago
Resolution: --- → FIXED
Would be nice if this could be tested in some way.
Flags: in-testsuite?
We could just toss the testcase into reftests so that they'd fail if this regressed.
Ok, but I especially meant the performance part of the bug. I mean, I think it's important to not regress this again.
If we put a long enough version of the testcase into reftests, the testing scripts will kill it :) I think reftests automatically fail if they take more than 20 secs or something like that.
maybe regression by this check-in, see below. http://forums.mozillazine.org/viewtopic.php?p=2980171#2980171
Depends on: 389398
I filed bug 389398 on the apparent regression.
Backed out due to the regression + freeze.
Status: RESOLVED → REOPENED
Resolution: FIXED → ---
Blocks: 375462
I really think this should be blocking, not just wanted....
This is pretty bad, and it blocks a blocker, so we'd better reevaluate it.
Flags: blocking1.9- → blocking1.9?
Assignee: sharparrow1 → roc
Status: REOPENED → NEW
Attached patch updated patch v7 (deleted) — Splinter Review
Here's a revised version of Eli's patch. The main change is that instead of returning from ReflowDirtyLines when we detect the clearance-change, we keep going, we just don't reflow any of the dirty lines (treating them as not dirty). This fixes the regression that patch caused, which I think was caused by SlideLine not being called so we forget that lines have moved. In general it's a more conservative fix because we execute mostly the same ReflowDirtyLines code in the "clearance changed" case as the normal case. It still fixes performance in the testcases mentioned in this bug nicely, though. The other change is to make CheckFloats not spew warnings when lines haven't had their float caches updated. If there are dirty lines, then we will reflow again so it's too early to spew warnings.
Attachment #248955 - Attachment is obsolete: true
Attachment #273031 - Attachment is obsolete: true
Attachment #286522 - Flags: superreview?(dbaron)
Attachment #286522 - Flags: review?(dbaron)
I don't know where "v7" came from...
Whiteboard: [reflow-refactor][wanted-1.9] → [reflow-refactor][wanted-1.9][needs review]
Flags: blocking1.9? → blocking1.9+
P1 because it's moderately risky and fixes real pages
Priority: -- → P1
Blocks: 368394
Comment on attachment 286522 [details] [diff] [review] updated patch v7 OK, r+sr=dbaron. Sorry for the delay.
Attachment #286522 - Flags: superreview?(dbaron)
Attachment #286522 - Flags: superreview+
Attachment #286522 - Flags: review?(dbaron)
Attachment #286522 - Flags: review+
Whiteboard: [reflow-refactor][wanted-1.9][needs review] → [reflow-refactor][wanted-1.9][needs landing]
checked in.
Status: NEW → RESOLVED
Closed: 17 years ago17 years ago
Resolution: --- → FIXED
Whiteboard: [reflow-refactor][wanted-1.9][needs landing] → [reflow-refactor][wanted-1.9]
Depends on: 406137
Depends on: 406568
Flags: wanted1.9+
Whiteboard: [reflow-refactor][wanted-1.9] → [reflow-refactor]
Depends on: 476357
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: