Re: [xml] too many mallocs?



On Mon, May 20, 2002 at 09:48:58PM +0200, Peter Jacobi wrote:
Daniel, All,

I didn't want to be negative, or criticize for
its own sake.

I'm just wondering about the stats I get. And asking,
if you're aware of the situation. 

  yes, that's something I'm aware of for a long time.

It may be a niche case to see malloc dominate, it's
most pronounced on a document without attributes but
with many tags, most of them empty, it's about 330k

On a rather mediocre WNT system, my xmllint needs 
260ms per iteration (Igor's MSFT version needs 410ms,
at least I can outperform this!). Of these 260ms, over
100ms are spent in malloc and free, and another large
part in related activities (_stos amd xmlStrndup).

  That would be around 1MByte/s, no that's not good.
On my Duron 1.2MHz parsing building a tree is at 6MB/s
(not validating).

Parsing the libxml2 API document (490k) is slower, showing
that attributes are more expensive than elements, using 400ms
(690ms) with about the same absolute time spent in malloc
and friends.

  Attribute normalization and such introduce more copies in
attributes, yes.

I'll try to understand better, what's going on, and maybe
there is a solution.

  Well some people suggested dropping xmlMalloc/xmlFree
to use alloca() in some context where the result is discarded 
anyway, but I'm not too fond of this.

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]