Closed Bug 339699 Opened 19 years ago Closed 19 years ago

Reduce number of calls to nsLineBox::Contains from nsBidiPresUtils::Resolve

Categories

(Core :: Layout: Text and Fonts, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED

People

(Reporter: uriber, Assigned: uriber)

References

()

Details

(Keywords: perf)

Attachments

(1 file, 1 obsolete file)

This bug is for implementing the performance optimization suggested by BZ in bug 330373 comment #24: > It seems to me that we should be doing the advancing at the places where we > call MarkDirty(); perhaps with a function that takes the frame, > nsBlockFrame::line_iterator& line, const nsBlockFrame::line_iterator& endLines? > That would also address the second concern I had, which is that the code as it > stands always iterates the lines, even if it doesn't actually change any > continuations. The performance problem is significant in lines with very many frames on them. I noticed this when trying to do "view selected source" after selecting the talkback section in http://www.ynet.co.il/articles/0,7340,L-3256726,00.html. The source contains about 1MB of complex HTML on a single line, which takes forever to render (effectively, the browser hangs). Using the "sample" feature in OS X's Activity Monitor, I can see that much of the time is spent in nsLineBox::IndexOf, called (via nsLineBox::Contains), from nsBidiPresUtils::Resolve.
Attached patch patch (obsolete) (deleted) — Splinter Review
Assignee: nobody → uriber
Status: NEW → ASSIGNED
Attachment #223803 - Flags: superreview?(bzbarsky)
Attachment #223803 - Flags: review?(bzbarsky)
Comment on attachment 223803 [details] [diff] [review] patch What about the concern you had in bug 330373 comment 24? r+sr=bzbarsky if you've resolved that to your satisfaction.
Attachment #223803 - Flags: superreview?(bzbarsky)
Attachment #223803 - Flags: superreview+
Attachment #223803 - Flags: review?(bzbarsky)
Attachment #223803 - Flags: review+
Hmmm... thanks for reminding me of that. It turns out that the newly-created frames do "know" what line they are on (the frame count on the line is incremented when creating a new continuation), so there is no functional problem. However, this change does cause nsLineBox::Contains to be called in cases where it currently isn't called (that is, for newly-created continuations), so I assume that for some cases (where there is originally a small number of frames, but some of them are broken into many bidi continuations), this will actually cause a performance hit. As the case described above is possibly more common than the one described in comment #0, I'm now hesitating whether this is worth doing.
Attached patch patch v2 (deleted) — Splinter Review
This should give us the best of both worlds.
Attachment #223803 - Attachment is obsolete: true
Attachment #223815 - Flags: review?(bzbarsky)
Comment on attachment 223815 [details] [diff] [review] patch v2 Yeah, I like this!
Attachment #223815 - Flags: superreview+
Attachment #223815 - Flags: review?(bzbarsky)
Attachment #223815 - Flags: review+
Checking in layout/base/nsBidiPresUtils.cpp; /cvsroot/mozilla/layout/base/nsBidiPresUtils.cpp,v <-- nsBidiPresUtils.cpp new revision: 1.77; previous revision: 1.76 done
Status: ASSIGNED → RESOLVED
Closed: 19 years ago
Resolution: --- → FIXED
Component: Layout: BiDi Hebrew & Arabic → Layout: Text
QA Contact: layout.bidi → layout.fonts-and-text
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: