W3C home > Mailing lists > Public > www-dom@w3.org > January to March 2001

Re: NodeList (Re: CSS::SAC)

From: Joseph Kesselman <keshlam@us.ibm.com>
Date: Wed, 21 Mar 2001 11:20:26 -0500
To: Robin Berjon <robin@knowscape.com>
Cc: Philippe Le Hegaret <plh@w3.org>, Bjoern Hoehrmann <derhoermi@gmx.net>, www-dom@w3.org
Message-ID: <OFADD61B91.E557E7FC-ON85256A16.00585F87@pok.ibm.com>

>I'm gunning for (to a certain degree at first, more later) but so is
>performance. Live NodeLists just don't work with the latter

The solution taken in the Java world, and as far as I can tell in the
JavaScript and C++ worlds, is that this is an accepted tradeoff. Nobody is
required to use NodeList; if they don't like its performance they can walk
the tree directly or use the DOM Level 2 Traversal feature instead.

There are some fairly straightforward implementation tricks which keep the
overhead minimal when NodeLists are not actively in use, ranging from a
flag which isn't set until the first NodeList is created to not rebuilding
NodeLists until they user actually accesses them. There are a number of
open-source fully-compliant DOMs in other languages; you might want to look
at how they've handled NodeList before you conclude that it's
unsupportable.

I freely admit that I've never liked NodeLists. I initially had  exactly
the same concerns you've voiced. But I  discovered that I could, in fact,
write a reasonable implementation which performs well in the most common
cases and performs correctly in the rest without an unacceptable amount of
impact on code size or performance of the rest of the DOM. NodeList will
always have some cases where its performance is horrendous and behavior is
unintuitive, but DOM users know that and write around it.

I really would recommend that Perl implementations adopt these strategies
and attempt full compliance with the DOM spec. Especially if you might be
interested in some day convincing the W3C to officially recognize a
standard Perl binding for the DOM.

______________________________________
Joe Kesselman  / IBM Research
Received on Wednesday, 21 March 2001 11:20:30 GMT

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