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: Thu, 25 Jun 2009 23:59:29 -0400
Message-ID: <4A4447A1.6080601@mit.edu>
To: Sean Hogan <shogun70@westnet.com.au>
CC: DOM public list <www-dom@w3.org>
Sean Hogan wrote:
>> Just as a data point, Gecko trunk had a bug earlier today where we 
>> accidentally introduce a performance regression on removing table 
>> rows.  The bug was easily caught because the regression made removing 
>> a table row O(N) in number of rows and it immediately turned out that 
>> all sorts of pages out there sort multi-thousand-row tables by 
>> reordering the row nodes in the DOM.
> Can you provide some URLs?

Here's an example: 

>> Which means that they're doing thousands to tens of thousands of DOM 
>> mutations.  And the time required needs to stay small (under 200ms, 
>> ideally, since that's about whether the user starts perceiving the 
>> operation as laggy).
> But in this case they wouldn't be using Mutation Events.

Wouldn't they?  Here's the entirety of the code on that page that does 
the table sorting:

       $(document).ready(function() {

Why wouldn't some other part of the page script, or of jquery, or of 
some random ad on the page if this were a page with ads happen to use 
mutation events?

> Sure. Every feature has its costs, and sometimes those costs mean you
> don't use it.
> I think the page author should make that decision for Mutation Events.

A lot of the more interesting pages (heck, the one cited above!) 
effectively have more than one author, so it's not that hard to get into 
situations where one of them decides to use mutation events and another 
has code that needs to run fast.

Received on Friday, 26 June 2009 04:00:17 UTC

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