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
|
|---|