Closed Bug 112525 Opened 24 years ago Closed 24 years ago

O(n^2) when dispatching events in nsView :: HandleEvent

Categories

(Core Graveyard :: GFX, defect)

defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED
mozilla0.9.7

People

(Reporter: kmcclusk, Assigned: kmcclusk)

References

Details

(Keywords: perf)

Attachments

(1 file)

The nsView::HandleEvent logic is Order(n^2) because it calls nsView::GetChild which searches a linked list of view's as it is traversing views during event dispatch. Getting rid of the call to GetChild produces a substantial speed improvement on the 300 combo box example in bug 39544 Un-modified (seconds) --------------------- 47.989 50.753 53.176 Avoiding O(n^2) call to GetChild --------------------------------- 17.736 18.327 19.718
Status: NEW → ASSIGNED
Keywords: perf
Target Milestone: --- → mozilla0.9.7
Blocks: 62568
This bug was split off from bug 62568
Blocks: 86952
Blocks: 39544
This is the right idea, but all this code is going to have to go away when I fix event handling for z-index and all that. (HandleEvent is going to call CreateDisplayList and then traverse the display list, which will require a different way of handling the "views deleted while handling event" problem. It will fix the O(n^2) behaviour too.) So I'd be happy to approve this but I will be taking it out again in a week or two :-).
Comment on attachment 59635 [details] [diff] [review] Patch which removes the O(n^2) call to GetChild in nsView::HandleEvent sr=kin@netscape.com
Attachment #59635 - Flags: superreview+
Attachment #59635 - Flags: review+
Fix checked in
Status: ASSIGNED → RESOLVED
Closed: 24 years ago
Resolution: --- → FIXED
I filed bug 112861 for the extra events that are generated during the creation of child windows. These events were the primary cause of the page load slowdown on pages with large numbers of comboboxes because they were causing the O(n^2) code in the viewmanager to be executed. Now that the fix in this bug has been checked in these events have less of an impact, but should still be suppressed to further improve performance on pages with lots of views.
Product: Core → Core Graveyard
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: