[XML-SIG] Optimizing getElementsByTagName()

W. Eliot Kimber eliot@isogen.com
Fri, 27 Apr 2001 15:51:55 -0500


"W. Eliot Kimber" wrote:
> 
> In my processing I'm using getElementsByTagName() a lot. I notice that
> in the current implementation is recalculates the subelement list every
> time you call it.
> 
> An obvious optimization would be to cache lists by tagName once
> calculated.
> 
> Is this an appropriate optimization? It would have some memory cost.

I thought about it some more and realized that it's probably not worth
the cost, especially when you factor in tracking mutations of the DOM,
which would invalidate the caches. Even in my own code, I was
constructing new lists much more than I was using cached lists.

Sorry for the bother.

Cheers,

E.

-- 
. . . . . . . . . . . . . . . . . . . . . . . .

W. Eliot Kimber | Lead Brain

1016 La Posada Dr. | Suite 240 | Austin TX  78752
    T 512.656.4139 |  F 512.419.1860 | eliot@isogen.com

w w w . d a t a c h a n n e l . c o m