You are viewing a plain text version of this content. The canonical link for it is here.
Posted to j-dev@xerces.apache.org by Arnaud Le Hors <le...@us.ibm.com> on 2001/09/14 01:54:47 UTC
DOM implementation improvement
I just checked in a change to our DOM implementation that leads to an
improvement of the memory footprint of up to 7% without much degradation
of the perfs. This has to do with the way I handle the cache of the
NodeLists (for getLength() and item(i)). I moved the fields into
separate objects that are only created when necessary and maintained in
a pool on the document. In a typical traverse of the tree we only need
"document depth" instances of them. So we gain by having smaller nodes,
and fewer caches (by large!).
There is one diff in perfs though. Because the cache objects are reused,
the length of the list (the number of children) has to be recomputed on
each node every time you traverse the tree. So, you may see an impact if
you do several traverses of the same document. It's still of the same
order though.
Traverses through the use of getFirstChild() and getNextSibling() are
not affected in any way. This only concerns people using
getChildNodes().
Let me know if you find any problem. Thanks.
--
Arnaud Le Hors - IBM, XML Standards Strategy Group / W3C AC Rep.
PS: thanks to Andy Heninger for his help in designing this and thinking
it through.
---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-j-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-j-dev-help@xml.apache.org
Re: DOM implementation improvement
Posted by Andy Clark <an...@apache.org>.
Arnaud Le Hors wrote:
> I just checked in a change to our DOM implementation that leads to an
> improvement of the memory footprint of up to 7% without much degradation
I'm amazed how you seem to be able to squeeze even more out
of the DOM implementation than I thought possible. Cool! :)
--
Andy Clark * IBM, TRL - Japan * andyc@apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-j-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-j-dev-help@xml.apache.org