Re: [xml] xmlAllocOutputBuffer uses XML_BUFFER_ALLOC_EXACT

Yes, that's a better patch than what I submitted and seems to work as well.


----- "Daniel Veillard" <veillard redhat com> wrote:

On Sat, Feb 21, 2009 at 09:29:49AM -0500, Christopher R. Palmer
In recent libxml2 code (I saw it when we moved from 2.6.32 to
2.7.2), the xmlBuffer object used by xmlAllocOutputBuffer changed from
using the DOUBLEIT allocator to the EXACT allocator.  This ends up
being used in xsltSaveResultToString.

We found that the time to save a node to a string (6MB) went from
about 1 second to about 13 seconds on a Windows installation.

I've attached a tiny patch that solves the issue for us.

  Okay I think it relates to this change:

Sat Aug 30 14:50:16 CEST 2008 Daniel Veillard <daniel veillard com>

        * include/libxml/tree.h tree.c: make a new kind of buffer
          shrinking and adding in head can avoid reallocation or full
          buffer memmoves
        * encoding.c xmlIO.c: use the new kind of buffers for output
and also

Mon Sep  1 15:02:05 CEST 2008 Daniel Veillard <daniel veillard com>

        * xmlIO.c HTMLtree.c: new internal entry point to hide even
        * better
        * tree.c: harden the code around buffer allocation schemes

 What you're seeing is at the intersection of this, where I tried to
avoid a lot of in-memory moves in edge cases and the long identified
but apparently still there problem of the realloc() performances on
 To be sure the change to DOUBLEIT should only be done if the value
EXACT, and not any of the other values.
 Can you check the enclosed path instead ?



Daniel Veillard      | libxml Gnome XML XSLT toolkit
daniel veillard com  | Rpmfind RPM search engine | virtualization library

Christopher R. Palmer                     palmer vivisimo com
Chief Technology Officer        
Vivisimo, Inc.                            412-422-2499 ext. 118

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]