Re: [css3-selectors] :parent selector

On Tue, 26 Sep 2006 14:57:02 +0200, Del Merritt <del@alum.mit.edu> wrote:
> A current (non-optimal) solution to the parent-child problem is to keep  
> the node structure around and chuck the text-only leaf data once it has  
> been rendered.  If the node structure is heavy, though, it still  
> presents a memory burden.  Sibling selectors present a similar problem,  
> compounded by the fact that you can't get rid of the siblings (or some  
> reduced cache of their presence) until you've handled the last one.   
> Think: "<body><p>blah</p><p>blah</p><p>blah</p>...<p>blah</p></body>"

That sounds like O(log n) to me, which isn't what I would call expensive.  
With a tree that is 4 levels deep, with 4 nodes at each level, that is 511  
nodes, of which only 17 would have to be kept open at the worst moment.

With a 10*10 tree with O(100,000,000,000) nodes, only O(100) would have to  
be kept open at the worst moment.

Steven

Received on Wednesday, 27 September 2006 14:02:13 UTC