Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

Re^7: Is there any XML reader like this? (XML::Simple beats LibXML hands down in the speed stakes!)

by tobyink (Abbot)
on Jan 15, 2012 at 16:15 UTC ( #948001=note: print w/ replies, xml ) Need Help??


in reply to Re^6: Is there any XML reader like this? (XML::Simple beats LibXML hands down in the speed stakes!)
in thread Is there any XML reader like this?

The LibXML example uses findnodes which is an XPath query. XPath, while extremely powerful, is not necessarily the most speedy solution, and it's not an especially fair comparison to the XML::Simple example. Replacing findnodes calls with getChildrenByTagName (the rest of the code can remain unchanged) speeds up the iteration tenfold. I get:

[tai@miranda (pts/0) libxml]$ perl orig.pl junk.xml
Parsing took 0.077047 seconds
Iteration took 6.021286 seconds
Total took 6.098525 seconds
[tai@miranda (pts/0) libxml]$ perl new.pl junk.xml
Parsing took 0.105245 seconds
Iteration took 0.631286 seconds
Total took 0.736719 seconds


Comment on Re^7: Is there any XML reader like this? (XML::Simple beats LibXML hands down in the speed stakes!)
Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://948001]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (8)
As of 2014-10-31 23:11 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    For retirement, I am banking on:










    Results (225 votes), past polls