Closed Bug 112861 Opened 24 years ago Closed 24 years ago

several toolkit events created during window creation are unnecessary

Categories

(Core Graveyard :: GFX, defect)

x86
All
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED
mozilla0.9.7

People

(Reporter: kmcclusk, Assigned: kmcclusk)

Details

(Keywords: perf)

Attachments

(2 files)

When a window is created the following NS_EVENTS are created: NS_CREATE NS_SETZLEVEL NS_MOVE Each of these events are dispatched to the view system. On pages with large numbers of views this causes a page load performance hit and most of these events seem to be unnecessary. lxr indicates that only NS_MOVE is being used. It is used in the webshell to record the position of the top-level window. We should generate a NS_MOVE only for top-level windows, not child windows. The NS_CREATE and NS_SETZLEVEL do not seem to be used at all and should be suppressed. In addition, some other events for child windows may not be necessary. We should investigate: NS_GOTFOCUS NS_LOSTFOCUS NS_ACTIVATE NS_DEACTIVATE There are also NS_MOUSE_MOVE events generated every time a child window is created. We may want to suppress mouse moves events that are generated as the result of a window create. As a test, I put a hack into nsViewManager to ignored all of the NS_CREATE,NS_SETZLEVEL, NS_MOVE events. Loading the 300 combobox testcase resulted in substantial improvement in load time: With unnecessary events ----------------------- 12.26 11.696 11.987 With events removed ------------------- 8.7 sec 8.823 Note: this test was done after I had already put in the patch for bug 112525 which removed the O(n^2) traversal of the view's when processing events.
Status: NEW → ASSIGNED
Keywords: perf
Target Milestone: --- → mozilla0.9.7
It looks like it is safe for the ViewManager to suppress the NS_MOVE, NS_CREATE and NS_SETZLEVEL events. nsWebShellWindow uses NS_MOVE and NS_CREATE but handles it by directly registering an event callback with it's window rather than going through the viewmanager. The other events: NS_GOTFOCUS, NS_LOSTFOCUS, NS_ACTIVATE, NS_DEACTIVATE are used in the event state manager and the plugin viewer, so they appear to be needed.
I split off the NS_MOUSE_MOVE issue on WIN32 into bug 113627
OS: Windows XP → All
Comment on attachment 60331 [details] [diff] [review] Patch to suppress NS_MOVE, NS_CREATE, NS_SETZLEVEL events looks good, but do we want to document this for clients of the ViweManager, so they know NOT to expect these events (and presumably register for them eventually). sr=attinasi
Attachment #60331 - Flags: superreview+
r=rods
I don't think clients of the viewmanager expected to receive these events in the first place. They really only make sense to capture when your managing a top-level window. Fix checked in.
Status: ASSIGNED → RESOLVED
Closed: 24 years ago
Resolution: --- → FIXED
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: