Re: [xml] XML_PARSE_COMPACT



On Wed, Jun 07, 2006 at 03:57:03PM -0600, Schubert, Aaron wrote:
Hello, I recently upgraded libxml to 2.6.23 and libxslt to 1.1.15.  I
read about the new XML_PARSE_COMPACT flag that can supposedly provide
some optimizations and I wanted to make use of that.  The problem is,
all throughout my code I call xmlParseMemory which doesn't allow me to
use the new flag.  So, I am guessing that I need to change all of these
calls to xmlReadMemory but I wanted to make sure that there aren't any
side effects that I am unaware of.  Is xmlParseMemory just an outdated
api now?  Also, I assumed that making the following changes would
provide equivalent results:

 

doc = xmlParseMemory(xml, strlen(xml));

doc = xmlReadMemory(xml, strlen(xml), NULL, NULL, XML_PARSE_COMPACT);

 

Am I way off base here?  Also, I only want to make this change if I am
guaranteed to receive some performance enhancement (I know that it
depends on the format of the xml to a point).

  Switching to the new parser routine is likely to provide noticeable
performance gains, XML_PARSE_COMPACT will lower the amount of allocated
blocks possibly significantly if you have short strings (or are running
on a 64 bits platform). If you don't modify the resulting tree this should
be perfectly safe.

Daniel

-- 
Daniel Veillard      | Red Hat http://redhat.com/
veillard redhat com  | libxml GNOME XML XSLT toolkit  http://xmlsoft.org/
http://veillard.com/ | Rpmfind RPM search engine http://rpmfind.net/



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