From: Daniel Veillard (Daniel.Veillard@w3.org)
Date: Wed Dec 01 1999 - 05:52:45 EST
On Fri, Nov 19, 1999 at 07:23:05AM -0500, Carl Nygard wrote:
>
> I'm using the DOM tree interface for creating and parsing xml files. I
> have binary data, which I pass through base64 encoding, and slap into
> the xml. The result of which, I've found that the libxml is terribly
> slow when parsing a node with gobs of text. The cause of this is the
> xmlStrcat/ncat functions, which always call xmlStrlen.
>
> I patched the libxml to use the xmlBuffer structure as the node->content
> instead of a plain xmlChar*. This made the performance at least an
> order of magnitude faster (I don't have timing results, but it went from
> ~8min to ~10sec), mostly because the xmlBuffer keeps track of the string
> length. I also changed the heuristic for reallocation, removing the
> (len+10) in favor of a simple 'if buffer not big enough, double it till
> it is' method. This also cuts reallocations down (but makes the space
> usage go up). I could understand if you took this back out to save
> space, but the profiling showed that the memcpy from constant
> reallocation was a big drain on performance.
Carl,
I have integrated your patches, they are commited to the CVS bases.
However since your patch:
- breaks binary compatibility (which we need to maintain for Gnome)
- increase the memory requirements needed to maintain DOM trees
(which can rightly be accused to be already hight).
I made it a compilation option. Use the --with-buffers flag of configure
to enable it, the C code is differenciated by the XML_USE_BUFFER_CONTENT
preprocessor define.
As a result, there is quite a few improvement to xmlBuffer added to
the libxml library, even if compiled without buffers.
thanks for your patch, I did some modification to avoid some troubles
when running "make testall" (non-trivial memory troubles).
Daniel
-- Daniel.Veillard@w3.org | W3C, INRIA Rhone-Alpes | Today's Bookmarks : Tel : +33 476 615 257 | 655, avenue de l'Europe | Linux, WWW, rpmfind, Fax : +33 476 615 207 | 38330 Montbonnot FRANCE | rpm2html, XML, http://www.w3.org/People/W3Cpeople.html#Veillard | badminton, and Kaffe. ---- Message from the list xml@rufus.w3.org Archived at : http://rufus.w3.org/veillard/XML/messages to unsubscribe: echo "unsubscribe xml" | mail majordomo@rufus.w3.org
This archive was generated by hypermail 2b29 : Wed Aug 02 2000 - 12:29:53 EDT