Re: [xml] too many mallocs?
- From: Daniel Veillard <veillard redhat com>
- To: Peter Jacobi <pj walter-graphtek com>
- Cc: xml gnome org
- Subject: Re: [xml] too many mallocs?
- Date: Mon, 20 May 2002 07:07:55 -0400
On Mon, May 20, 2002 at 12:30:28PM +0200, Peter Jacobi wrote:
Daniel, All,
In the process of better understanding the inner
workings of libxml2, and noting that simple parsing
is bound by malloc in my tests, I came across
following factoid:
Going from the input file
<foo><bar><xxx>XXXXXX</xxx><yyy>YYYYY</yyy></bar></foo>
to
<foo><bar><xxx>XXXXXX</xxx><yyy>YYYYY</yyy></bar><bar><xxx>XXXXXX</xxx><yyy>YYYYY</yyy></bar></foo>
The number of mallocs used by libxml2 raises by 44 (from 120 to 164).
This seems a bit wasted for two new start tags, two new end tags and
two new char nodes.
okay, I take patches as long as they preserve:
1/ the portability
2/ the conformance to the XML spec and the results of the
various regression tests
And there are 37 mallocs of size 3944 in case 1, compared with
62 mallocs of size 3900 in case 2, most likely from xmlInputBufferGrow.
I think Garry Pennington looked at this recently.
Is something broken with my libxml2? I compiled 2.4.21 with
all features off. (Using Watcom C 11.0b under WNT4.0).
Is gcc's malloc such a fine piece of art, that you don't see
negative effects from these large number of mallocs?
Gcc does not provide malloc, this is a libc and hence system dependant
operation. If you know how to make the same result without going through
the same number of allocations, please feel free to share your knowledge,
I will definitely take patches !
Daniel
--
Daniel Veillard | Red Hat Network https://rhn.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]