Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
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?
[SuicideJunkie]: Blergh. Trying to work into low level C code, stuff that would have been so easy with a regex.

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (13)
As of 2016-12-07 21:23 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    On a regular basis, I'm most likely to spy upon:













    Results (131 votes). Check out past polls.