Re: Wikipedia dump file processing shoot out
Tyler Riddle <[email protected]>
| Newsgroups | gmane.comp.lang.perl.xml |
|---|---|
| Message-ID | <[email protected]> |
>> Has anyone tried to identify WHY libxml/xslt running in perl is AT ALL
>> slower than C? Obviously there is SOME going back and forth between perl and
>> C there, but it kind of seems hideously more expensive than it should be.
>>
> There's an old thread about this [1]. Basically the performance penalty
> comes from the XS interface: invoking an XS method is very expensive [2].
> I've encounter this when I started writing Xacobeo [3] in which I was
> displaying an XML document by traversing a DOM tree with XML::LibXML in pure
> Perl.
>
I'm really curious why libxml's perl SAX interface performs so poorly
compared to the others especially because libxml's SAX interface in C
slightly outperforms expat:
'name' => 'libxml.t',
'percentage' => 100,
'name' => 'expat.t',
'percentage' => 112,
'name' => 'XML-SAX-ExpatXS.t',
'percentage' => 526,
'name' => 'XML-Parser.t',
'percentage' => 676,
'name' => 'XML-SAX-ExpatXS_nocharjoin.t',
'percentage' => 981,
'name' => 'XML-LibXML-SAX.t',
'percentage' => 1082,
Actually now that I look at the data stacked up like that it makes
perfect sense - it's not really that much slower than expat, it's
XML::SAX::ExpatXS's character joining feature that is giving it the
speed benefit. I have RT ticket #52368 open with XML-LibXML to add
this exact feature but I have not heard anything back on it yet. I
fear my C skills are not up to par to have the patch integrated off
the bat. My modifications also cause 2 seemingly unrelated tests to
fail which I was not able to identify why.
Is there anyone who could fix my patch or just re-implement it
considering it's not a hard feature to do? It'd be nice to have libxml
performing to it's full potential.
Also how did XML::Parser pull of it's speed feat by wrapping expat but
not doing character joining? Inquiring minds want to know.
Cheers,
Tyler Riddle
--
If you wish to make an apple pie from scratch you must first invent
the universe. -- Carl Sagan
_______________________________________________
Perl-XML mailing list
[email protected]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs