W3C home > Mailing lists > Public > www-dom@w3.org > October to December 1998

Re: An observation about "live" NodeLists

From: Ray Whitmer <ray@imall.com>
Date: Mon, 19 Oct 1998 13:06:57 -0600
Message-ID: <362B8DD1.B29949F3@imall.com>
To: www-dom@w3.org
Miles Sabin wrote:

> Perhaps, perhaps not.
>
> The trouble with your suggestion is that it seems to require
> that every active NodeList on a given subtree (maybe all active
> NodeLists over the whole tree?) has to be visited each time that
> subtree is modified. This means that we have an extra multiplier:
> the number of active NodeLists. Now, how many of those are there?
> How long is a piece of string? In Java, at least, this is a
> serious issue, because the vagaries of GC make it impossible
> to tell particularly early whether or not a NodeList is in use.

Every Nodelist started from any ancester of the subtree which is
modified must be visited.  That is not a big list of nodes to visit.  If
there are thousands of active NodeLists, Iterators, etc. it could be a
bottleneck.

Yes, it could degrade if badly overused.  But what I was pointing out
that the iterators have to be fixed up in a similar fashion.  There is
no big win using iterators in the given use cases.

This specification does not look bad, and there seems to be a distinct a
lack of alternatives that would perform better.

If you like static lists better, write simple method that iterates the
entire nodelist, building a static list and despose it before someone
has a chance to mutate it, and you will have about the same (miserable
for most of my uses) performance you would have gotten if static lists
had been part of the spec.

Ray Whitmer
ray@imall.com
Received on Monday, 19 October 1998 15:08:24 GMT

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