Re: An observation about "live" NodeLists

Miles Sabin wrote:

> Ray Whitmer wrote,
> > I must have missed something here.  Even with unpredictable
> > Java GC, we are still much better off with weak references
> > than without.  I would interpret this as greatly helping
> > address the problem.
>
> I guess a lot turns on what you count as 'much better off'.
> As far as I can see all you gain is not having to implement
> the handle-body pattern ... but I think for anyone able to
> implement the DOM reasonably well that ought to be a trivial
> exercise.

For this case, handle-body is equal to weak references.  With either one
of the two, you are much better off than without either, which was what
I intended to communicate.

> As it happens, handle-body+finalize is the guts of the
> underlying implementation of weak refs in 1.2 as a peek
> at the JDK sources will reveal.

When I looked at it in the past, it did not work that way.  I believe it
solves problems that cannot be solved merely by handle-body.  I will
look at it again, and get back to you privately.

> OK, that's speculation ... I'd be interested to see some
> stats and analysis from someone (Ray?) who's put that sort
> of implementation together.

My DOM runs on the server, but I don't have good stats available yet for
reclaiming NodeLists for a variety of reasons:

1.  Our implementation directly implements children as lists, so this is
not an issue when processing child lists.  At most, we only ever need
one NodeList per node, which never get fixed up artificially.  So they
never pile up in the first place.
2.  getElementsByTagName is not something we call much on the server for
long-lived documents, because for documents which stay around for a long
time, we build advanced indexes for them so we can find things in them
quickly.
3.  Our stress tests have been quite artificial.  We will be going live
within the next month or so.
4.  If we ever did forsee a use case that might stress test it, I would
quickly build indexes.

If you create the tests, I will be happy to run it and give you back any
stats you would like.

Ray Whitmer
ray@imall.com

Received on Tuesday, 20 October 1998 15:27:59 UTC