Re: [xml] xmlAllocOutputBuffer uses XML_BUFFER_ALLOC_EXACT



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

Cheers,
Chris.


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

On Sat, Feb 21, 2009 at 09:29:49AM -0500, Christopher R. Palmer
wrote:
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
where
          shrinking and adding in head can avoid reallocation or full
          buffer memmoves
        * encoding.c xmlIO.c: use the new kind of buffers for output
          buffers
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
          xmlAllocOutputBufferInternal
        * 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
Windows.
 To be sure the change to DOUBLEIT should only be done if the value
is
EXACT, and not any of the other values.
 Can you check the enclosed path instead ?

  thanks,

Daniel

-- 
Daniel Veillard      | libxml Gnome XML XSLT toolkit 
http://xmlsoft.org/
daniel veillard com  | Rpmfind RPM search engine http://rpmfind.net/
http://veillard.com/ | virtualization library  http://libvirt.org/

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




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