[XML-SIG] Optimizing getElementsByTagName()

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


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.

Using getElementsByTagName() is very convenient in my business logic,
but I could replace it with my own iteration over child nodes. But
normally I would presume that these sorts of queries would be optimized
by the underlying implementation. Here they are not.

Any other thoughts on optimization for this method? I'll implement the
cache approach and see how it works.

Thanks,

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