You are viewing a plain text version of this content. The canonical link for it is here.
Posted to c-dev@xerces.apache.org by du...@berzerker.net on 2003/09/29 08:54:26 UTC

Efficiency of document fragments?

We used the XMLSpy Code Generator in order to fast-prototype and develop
some XML software in C++. Xerces was selected as the underlying DOM under
the higher level XMLSpy-generated object model.  All worked great but we
do have some memory leak issues (we have to process hundreds of XML files
at a time and they bogged down the system because of the memory leak --
XMLSpy issued a bug report related to it).  Anyway ... that was just
background ...

Typically in our calling sequence we are "constructing and populating" XML
node subtrees and then attaching them to parent node(s) afterwards i.e.
making use of document fragments and then appending those to parent nodes.
Is this less efficient than doing the parent/child attachment before
further populating the children with more nodes?  Is there a preferred
way?

thanks,
durwood




---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-c-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-c-dev-help@xml.apache.org


RE: Efficiency of document fragments?

Posted by Erik Rydgren <er...@mandarinen.se>.
Nope the penalty for using document fragments is very low. The fragment
has to be allocated / deallocated of course and there will be an extra
node insert performed. So the price is low. However if you construct
many fragment the overhead will be noticeable. And if you construct a
fragment for each node in the tree the overhead will be significant. In
that case I would consider sending the parent node to be populated
around in the system instead.

/ Erik

> -----Original Message-----
> From: durwood@berzerker.net [mailto:durwood@berzerker.net]
> Sent: den 29 september 2003 08:54
> To: xerces-c-dev@xml.apache.org
> Subject: Efficiency of document fragments?
> 
> We used the XMLSpy Code Generator in order to fast-prototype and
develop
> some XML software in C++. Xerces was selected as the underlying DOM
under
> the higher level XMLSpy-generated object model.  All worked great but
we
> do have some memory leak issues (we have to process hundreds of XML
files
> at a time and they bogged down the system because of the memory leak
--
> XMLSpy issued a bug report related to it).  Anyway ... that was just
> background ...
> 
> Typically in our calling sequence we are "constructing and populating"
XML
> node subtrees and then attaching them to parent node(s) afterwards
i.e.
> making use of document fragments and then appending those to parent
nodes.
> Is this less efficient than doing the parent/child attachment before
> further populating the children with more nodes?  Is there a preferred
> way?
> 
> thanks,
> durwood
> 
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: xerces-c-dev-unsubscribe@xml.apache.org
> For additional commands, e-mail: xerces-c-dev-help@xml.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-c-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-c-dev-help@xml.apache.org