Closed Bug 112253 Opened 24 years ago Closed 24 years ago

Reduce number of outliner row repaints and speed up painting of rows

Categories

(Core :: XUL, defect)

x86
All
defect
Not set
normal

Tracking

()

RESOLVED FIXED

People

(Reporter: Bienvenu, Assigned: Bienvenu)

Details

Attachments

(1 file, 6 obsolete files)

Profiling loading a mail folder shows that we're spending a lot of our time repainting outliner rows. This is both because we're painting rows multiple times, and painting cells is expensive because nsXULTemplateBuilder::ParseAttribute is expensive and (it seems to me), inneficient. I'll attach a patch that cuts the startup row paints by 75%. The patch eliminates the background paint of each cell after drawing the background rect, and eliminates some invalidations when scroll bar and focus state haven't changed. I don't know if these changes are the right thing to do or not, but I'm trying them out and asking for guidance.
Attached patch reduce the number of paints (obsolete) — Splinter Review
Dave, what about the other changes, to not invalidate on SetFocus or ShowScrollbars if the focus/scroll bar state hasn't really changed? This seems to cut down row paints down significantly on startup by itself.
The focus change looks ok, although fix the indentation on it. I need more context for the "else return NS_OK" portion of the patch.
the routine with the else return NS_OK is nsOutlinerBodyFrame::SetVisibleScrollbar
Attached patch fixes for outliner image cache (obsolete) — Splinter Review
I've made three changes here - the first is that in nsOutlinerBodyFrame::GetImage, when we've found out we already have a pending request for an image, we should return after adding the row to the list of rows to be notified, instead of falling through to the code that makes another request to fetch the image. Often (always?), the second request cancelled the notification for the first request, because it overwrote the hash table entry for the request. (I believe this might explain the problems we've sometimes seen with images not getting painted in the thread/folder pane on startup). The second change is to increase the hashtable size to 64 - mailnews seems to use more than 32, and it's very cheap to set the hash table size to 64 instead. The third change is to AddRow, to start mMin at -1, so that we don't invalidate from 0 to mMax all the time.
OK, I'm pretty much done for now with the outliner changes - the number of row paints on startup has been cut from 750 to 125 for my test case, so I'm satisfied for now. Can I get some r and sr's for the patches? Thx!
Status: NEW → ASSIGNED
Attachment #59391 - Attachment is obsolete: true
I applied all 3 patches and tested a little bit. Works great, changes make sense to me. r=varga
One last change - because SetVisibleScrollbar no longer invalidates the whole outliner if the visibility of the scrollbar hasn't changed (see my first patch), a slight error in nsOutlinerBodyFrame::RowCountChanged was exposed - it doesn't account for the last, partial row. GetLastVisibleRow doesn't return partial rows (perhaps it should - I don't really know), so I just incremented last and everything works fine. The problem I was seeing before this last fix was that if a new message arrived and put at the bottom of the thread pane (and was partially clipped), it wasn't painted at all. And if you deleted it, it wasn't repainted either. Now everything seems to work fine.
The change to SetVisibleScrollBar() undiscovered another bug. Just what David already said, but I think this could be done a different way. Attaching patch
Attached patch patch (obsolete) — Splinter Review
Comment on attachment 59957 [details] [diff] [review] patch the change to GetLastVisibleRow makes sense - I thought about doing it that way, but I wasn't sure what other callers (it's a public method) might expect. The second change, I'm a little confused by - if you change GetLastVisibleRow as you did, and take out the last++ that I put in, then last == mTopRowIndex + mPageCount, not mTopRowIndex + mPageCount + 1 (or is that intentional?)
originally GetLastVisibleRow() was implemented as: mTopRowIndex + mPageCount + 1 then it was changed to: mTopRowIndex + mPageCount - 1 now I recall that I did review for this change, mea culpa I didn't notice that and I think |mTopRowIndex + mPageCount + 1| in InvalidateRange() is actually GetLastVisibleRow(), but it was not fixed There are only 2 callers of this method I know. One in /layout/base/src/outliner and one in patch for autoscrolling in thread pane (don't know if it was checked in)
OK, I'll apply your patch, and remove my last patch, and run with it for a bit. Thx for the help.
Can I get a single patch with all the changes in it? I'm getting confused about which is the real patch.
Attachment #59581 - Attachment is obsolete: true
Attachment #59730 - Attachment is obsolete: true
Attachment #59856 - Attachment is obsolete: true
Attachment #59945 - Attachment is obsolete: true
Attachment #59957 - Attachment is obsolete: true
Fix the indentation in SetFocused. You need to indent everything inside the new if statement you're wrapping everything in. sr=hyatt
thanks, Dave. It really is indented correctly in my tree; it's just not showing up correctly in cvs -uw diff.
fix checked in.
Status: ASSIGNED → RESOLVED
Closed: 24 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: