Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw

XML::LibXML vs XML::Parser and friends

by merlyn (Sage)
on Aug 29, 2003 at 13:57 UTC ( #287656=note: print w/replies, xml ) Need Help??

in reply to xml parsers: do I need one?

Adding my own experience to what's already been said here...

XML::Parser-based solutions (including XML::Simple) basically use C code to recognize tokens, but then have to build Perl data structures for the entire data tree, even for the parts that aren't being used.

XML::LibXML (if you can get it built and working, because it can be a bit finicky) builds the DOM as a C-side data structure. It's fast. Very fast. From the Perl side, you then ask for precisely the parts of the tree you want (with either DOM or XPath syntax), and only then are the heavyweight Perl objects created for those particular elements.

I've also seen benchmarks that libxml2 (on which XML::LibXML is based) is far faster at just recognizing the tokens than expat (on which XML::Parser is based). This also helps with speed.

I've pretty much abandoned any use of expat-based solutions now. XML::LibXML is it.

-- Randal L. Schwartz, Perl hacker
Be sure to read my standard disclaimer if this is a reply.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://287656]
[NodeReaper]: he's already hiding from me :(
[Corion]: Your Mother: Even I don't remember what "related and neat" I could have that would fit to 1211240 :) Maybe "pjax", which turns a static site into a Javascript-partial -reloading site? That's purely Javascript though
[LanX]: true I might get visa problems when they hear about my love for massacres ...
[Your Mother]: Corion, it was something similar to Cometd/Websockets.
LanX is reminded that public sarcasm is causing rpoblems nowadays ... ehm ...
[Your Mother]: Americans love massacres as long as it's brown and red people. Ooops. That was supposed to be a state secret. There goes my Q clearance.
[Your Mother]: It would hillarious to learn the Flat Earth movement was started by misunderstood sarcasm.
[Corion]: Your Mother: Aah - Server Side Events maybe, which mostly sends events from the server as they come up?
[Your Mother]: Sounds right.

How do I use this? | Other CB clients
Other Users?
Others meditating upon the Monastery: (11)
As of 2018-03-19 13:35 GMT
Find Nodes?
    Voting Booth?
    When I think of a mole I think of:

    Results (240 votes). Check out past polls.