Re: [xml] Performance of DOM interface
- From: Christian Glahn <christian glahn uibk ac at>
- To: xml gnome org
- Cc: wellnhofer aevum de
- Subject: Re: [xml] Performance of DOM interface
- Date: Mon, 26 Aug 2002 14:56:12 +0200
On Mon, Aug 26, 2002 at 01:44:51PM +0200, wellnhofer aevum de wrote:
hi nick,
hi list,
Matt Sergeant wrote:
On Saturday, August 24, 2002, at 07:12 PM, Nick Wellnhofer wrote:
Daniel Veillard wrote:
On Sat, Aug 24, 2002 at 03:13:08PM +0200, wellnhofer aevum de wrote:
<SNIP/>
I'm using libxml and libxslt with Perl to generate dynamic HTML
pages and did some performance testing recently. I created a XML
tree from a Perl data structure using the DOM interface and
transform that tree with XSLT.
<SNIP/>
Yeah, it's all the method calls, and also the memory allocation and the
reference counting that the Perl level API has to do, but the C one
doesn't. It *might* be quicker to do it in perl-space and create an XML
string and then parse it.
I just replaced the following Perl code to create a XML element
containing only text
my $child = $doc->createElement($k);
$node->appendChild($child);
my $text = $doc->createTextNode($v);
$child->appendChild($text);
with the equivalent
$node->appendTextChild($k, $v);
Building the DOM tree is now two times faster, but still a little slower
than the XSLT transformation.
a major diffrerence between libxml2 and its Perl interface is the fact, that
in C you can leave the memory management to a user while you can't in perl.
thus the module has to do all management itself.
through this you will loose a lot performance while the modules does not
cause memory leaks. there are still some obvious issues that slow XML::LibXML
down a 'bit'.
i tried to add some functions to avoid some perl overhead during DOM building,
such as appendTextChild(), which is the reason why this significantly speeds
the processing up.
christian glahn
Nick Wellnhofer
_______________________________________________
xml mailing list, project page http://xmlsoft.org/
xml gnome org
http://mail.gnome.org/mailman/listinfo/xml
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]