W3C home > Mailing lists > Public > www-dom@w3.org > April to June 2009

Re: Mutation events - slowness examples

From: Boris Zbarsky <bzbarsky@MIT.EDU>
Date: Sat, 06 Jun 2009 15:16:25 -0400
Message-ID: <4A2AC089.1080908@mit.edu>
To: Fran├žois REMY <fremycompany_pub@yahoo.fr>
CC: www-dom@w3.org, "Michael A. Puls II" <shadow2531@gmail.com>
Fran├žois REMY wrote:
> There's cleary two factors that apply :
> ==> Time needed to move from managed C++ to unmanaged JScript
> ==> Time of JScript execution

You missed a third one: DOM event dispatch per se.

For example, on your test2, I see the following in a current trunk 
Firefox build:

10% of total time spent creating DOM nodes from the string.
40% of total time spent handling the insert internally
    (creating the layout objects, etc).
45% of total time spent firing and handling the DOM event.

That last 45% breaks down as follows (all percentages are of total 
testcase time):

   10% building up the event target chain and doing pre- and
       post-dispatch handling of various sorts.
    6% traversing that chain.
    5% looking for listeners for this event on the various targets in
       the chain.
    6% setting up the right security context for the event dispatch.
    8% creating the necessary JS objects (I have no idea why this takes
       so long).
    8% making the actual call into JS.

Note that about half the "event dispatch time" is used even if there is 
no listener to dispatch to (though if there is really no listener we 
optimize away the mutation event dispatch altogether)...

-Boris
Received on Saturday, 6 June 2009 19:17:06 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Friday, 22 June 2012 06:14:00 GMT