[Patch] HTMLCollection cache (was: phpnuke 7.3 slowness)

Koos Vriezen koos.vriezen at xs4all.nl
Wed Sep 8 08:09:12 BST 2004


On Sat, Sep 04, 2004 at 06:29:55PM +0200, Koos Vriezen wrote:
> On Sat, Sep 04, 2004 at 04:20:16PM +0200, Koos Vriezen wrote:
> > Unfortunately, HTMLCollectionImpl::getItem only digs inside the tree, so
> > as soon as we hit a lastChild leaf, we must start again for
> > HTMLCollectionImpl::item. Still this give a more then five time speedup.
> > The length calculation is reduced to only one in the above case.
> 
> Silly me, HTMLCollectionImpl::nextItem has a way to do that smart. So
> attached an even faster one :-)

Actually given this patch, doesn't it make sense to implement 
HTMLCollectionImpl::firstItem as HTMLCollectionImpl::item(0) and
HTMLCollectionImpl::nextItem as HTMLCollectionImpl::item(cached_pos+1),
and mark these as deprecated in dom/html_misc.h? Not only are they
not needed anymore, they are not safe for domtree changes while iterating
in the current implementations.

Koos




More information about the kfm-devel mailing list