W3C home > Mailing lists > Public > public-webapi@w3.org > April 2008

Re: [Element Traversal LC] access to element by index

From: Jonas Sicking <jonas@sicking.cc>
Date: Tue, 08 Apr 2008 10:35:52 -0700
Message-ID: <47FBACF8.30804@sicking.cc>
To: Jean-Yves Bitterlich <Jean-Yves.Bitterlich@Sun.COM>
CC: "Web APIs WG (public)" <public-webapi@w3.org>

Jean-Yves Bitterlich wrote:
> A few alternatives were proposed here, referred below as
>    (i) 'attribute NodeList childElements',
>   (ii) 'Node item(index)' and
>  (iii) xpath .querySelector.
> 
> I personally like (iii) because it is powerful (or is it just queries 
> that are powerful?), however it definitely belongs to another spec.
> 
> Alternative (i) has its advantages and disadvantages that were also 
> theoretically mentioned in this thread. However, from our experience in 
> the mobile space and in particular given our implementations (optimized 
> SVG and 280-DOM, both for Java-ME), it would cost extra memory and code 
> execution: the implementation would need to create an object with very 
> short life span (an instance of NodeList). It should hurt the 
> performance on two fronts: extra garbage collection and extra code 
> execution. On the other hand, if Elements would cache the NodeList 
> object it will inevitably affect RAM footprint.

Do you have any data on how much extra this footprint would be? It seems 
to me that it usually should be very small compared to the other things 
stored in a DOM, such as attribute values and text nodes, not to mention 
all rendering objects needed to display a web page.

/ Jonas
Received on Tuesday, 8 April 2008 17:38:47 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Tuesday, 8 April 2008 17:38:48 GMT