Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

XML Parsers - speed / performance and ease-of-use

Status
Not open for further replies.

wardy66

Programmer
Jun 18, 2002
102
AU
Hi all

I'm trying to parse an XML file that looks like:

Code:
<?xml version="1.0" standalone="yes" ?>

<abc>
  <def>
    <ghi>
      <jkl>information</jkl>
    </ghi>
    <important>
      <data>
        <info1>info 1</info1>
        <info2>info 2</info2>
      </data>
      <data>
        <info1>info</info1>
        <info2>info</info2>
      </data>
    </important>
   </def>
</abc>

The real file is > 800,000 lines long.

I wrote a parser to grab a list of the info1 and info2 data in XML::Twig, XML::SAX and XML::parser.

After a bit of searching I am lead to believe SAX is the way to go. XML::Twig looked interesting but seems to choke on the size of the document, even though it is supposed to be able to "simulate" stream processing as opposed to tree.

XML::parser was the fastest, SAX about 50% slower and Twig several times slower.

Anyway, my question is this.
What recommendations do people have for XML parsing? I'm happy to move with the times and move away from XML::parser but 50% delay seems a bit much.

I loaded XML::SAX::ExpatXS which seems to be the fastest SAX processor but it's still a lot slower.

Any suggestions? :)

Thanks
~ Michael
 
At the risk of being Warnock'd again :) I did a bit more testing of parser times, using XML::SAX::XSExpat vs XML::parser

I'm still seeing slower SAX times than XML::parser but not as bad as I first suspected. But consistently slower.

Is the general consensus that SAX is the future? If so, I can put up with it as I agree it's a bit nicer to use.

Is there another parser anyone knows of that might help me out?

Should I be posting elsewhere?

Thanks for any info

~ Michael
 
Sorry mate, I dont know. Try on perlmonks.com, seems nobody here is knowledgable in this particular area.

------------------------------------------
- Kevin, perl coder unexceptional! [wiggle]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top