Re: memory allocations / libxml



Hi Daniel,

	Oh dear, it seems I screwed up the communicating business again,
bother:

On Mon, 2002-03-04 at 10:35, Daniel Veillard wrote:
> > 	Is that an easy thing to do Daniel ? clearly I'd rather use libxml than
> > writing my own XML parser :-) we already use the fast SAX interface.
> 
>   No idea what you're speaking of. Write your own parser, and maintain it !

	Precisely what I don't want to do :-) the smiley was if anything a grin
at Havoc, personally I don't think writing my own parser is a terribly
profitable use of time when we have two that work well already,
especially if I can help speed up every libXML user's parsing experience
in the process. 

>   Again no idea what you're speaking about. Allocca is not portable,
> I won't use it .

	Alloca works on any platform that glib runs on, and is 2-3 (?) orders
of magnitude faster than malloc/free, of course, I have no idea what I'm
asking for - which is an advantage in asking boldly, but is it so much
to as for:

	len = token_length;

	if (len > 64)
		dup = xmlStrndup (buf, len);
	else {
		dup = g_alloca (len + 1);
		memcpy (dup, buf, len);
		buf[len] = '\0';
	}

	ctxt->fooCb (ctxt, dup);

	if (len > 64)
		xmlFree (dup);

	If it can kill the locking penalty, and thus improve parsing speed for
all the Gnome code, is that worth doing ? wait I'll read libxml a bit
and see ...

	So - reading it it seems that's a rather hopeless strategy due to the
complexity of the problem and the structure of the code to solve it.
Hmm, clearly the big strdup then trample on the buffer to delimit the
strings as we parse it is quite attractive (to me at least), would you
be prepared to tolerate something like ORBit2's intelligent allocation
stuff, such that strings with a prepended '\0' are never freed, and we
prepend a non '\0' to all allocated strings ? or am I smoking crack ?
either way that's a more long termish solution.

>    I will fix it the day you will report it normally. I.e. either by
> posting the problem on the mailing list of through bugzilla. Sending mail
> ending up in my inbox are getting there with 500 others and possibly deleted
> discarded or forgotten. Time you learn about process ...

	Oh dear, I've done it wrong again - personally I prefer E-mail you see,
so I tend to think everyone else does, apologies. I've filed a bugzilla
bug for you: http://bugzilla.gnome.org/show_bug.cgi?id=73430.

	Prolly is time I got used to the bugzilla process,

	Thanks,

		Michael.

-- 
 mmeeks gnu org  <><, Pseudo Engineer, itinerant idiot

_______________________________________________
gnome-hackers mailing list
gnome-hackers gnome org
http://mail.gnome.org/mailman/listinfo/gnome-hackers



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