Open Bug 300307 Opened 19 years ago Updated 2 years ago

Continuation model has performance issues if we have a lot of continuations

Categories

(Core :: Layout, defect)

x86
Linux
defect

Tracking

()

People

(Reporter: bzbarsky, Unassigned)

Details

STEPS TO REPRODUCE:
1)  Load
http://lxr.mozilla.org/seamonkey/source/layout/base/nsCSSFrameConstructor.cpp
2)  Wait for pageload to finish
3)  Print it to file

ACTUAL RESULTS: long freezeup before printing progress dialog appears.

EXPECTED RESULTS: minimal freezeup

I profiled this, and here's what I see:

Total hit count: 336115
Under nsBlockFrame::Reflow: 156570
  Of these, under nsBlockFrame::DrainOverflowLines: 155486

The problem, of course, is that this is a really long page.  So the first block
sticks almost all the lines on its overflow list.  The next block grabs them all
(which involves reparenting them, etc), then sticks most of them right back on
the overflow list.  And so it goes.  The total number of times through
DrainOverflowLines() is O(N) in page length, so any operation done on each line
in DrainOverflowLines() is done O(N^2) times in number of lines...

Could we perhaps drain lines lazily in the case when we have no lines of our own?
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.