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: Sun, 07 Jun 2009 09:24:18 -0400
Message-ID: <4A2BBF82.3070000@mit.edu>
To: Sean Hogan <shogun70@westnet.com.au>
CC: www-dom@w3.org
Sean Hogan wrote:
> It's only huge if it noticeably affects the UX. 


> This example arguably proves that it does not: 1024 DOMNodeInserted events and it's only just on the threshold of user awareness - 100ms.

Again, for a very shallow DOM.

> And this test doesn't even include the time for rendering - I've done some primitive testing and for a smaller number of inserted nodes (say 100) the rendering takes longer than the event dispatch.

This will strongly depend on the DOM, the exact sequence of calls used 
to construct it, etc.

For myself, the performance problems I've seen that Jonas' proposal is 
trying to address are more common with attribute modification than node 

> Agreed. I guess by current spec I mean using DOM Events as opposed to some new handling scheme. But couldn't we just change the spec so that Mutation Events are asynchronous? Is anyone relying on them being synchronous?

I believe so, yes.

> In fact, my testing indicates there is no time difference between "DOMNodeInserted listener not on parent chain" and no DOMNodeInserted listener. Do you have examples that demonstrate otherwise? 

You'd need a pretty deep DOM and a bunch of modifications that are very 
cheap in and of themselves (this test, which does a whole bunch of work 
for the one modification it makes, is not a good example).

But even then, the overhead is pretty low for this case.  We try hard to 
make it so.  ;)

Received on Sunday, 7 June 2009 13:25:00 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 20 October 2015 10:46:14 UTC