Fastest XML parser for Perl

My perl application is doing a lot of xml file input and output, and I'm finding that the bottleneck in the application is the XML parsing. I'm looking for advice on what is the most efficient XML parsing module is, and what I can do to optimize XML reading/writing in general.

Currently, I'm using XML::Simple, with XML::SAX installed. Here is a look at my dproffpp output currently:

%Time ExclSec CumulS #Calls sec/call Csec/c  Name
 15.3   1.476  1.816  49365   0.0000 0.0000  XML::Simple::collapse
 13.3   1.287  2.459 132588   0.0000 0.0000  XML::SAX::Expat::_handle_char
 11.8   1.135  2.805  49365   0.0000 0.0001  XML::SAX::Expat::_handle_start
 10.0   0.968  7.429    515   0.0019 0.0144  XML::Parser::Expat::ParseStream
 9.46   0.910  1.179  49365   0.0000 0.0000  XML::SAX::Expat::_handle_end
 8.31   0.799  0.799 132588   0.0000 0.0000  XML::Simple::characters
 7.25   0.697  0.697  49365   0.0000 0.0000  XML::Simple::start_element
 4.74   0.456  1.172 132588   0.0000 0.0000  XML::SAX::Base::characters
 4.54   0.437  0.437  49365   0.0000 0.0000  XML::NamespaceSupport::_get_ns_details
 3.00   0.289  0.308  44287   0.0000 0.0000  XML::Simple::array_to_hash
 2.26   0.217  0.217  49365   0.0000 0.0000  XML::NamespaceSupport::push_context
 1.93   0.186  0.205   5395   0.0000 0.0000  Params::Validate::_validate
 1.85   0.178  0.323   3378   0.0001 0.0001  DateTime::TimeZone::new
 1.79   0.172  0.853  49365   0.0000 0.0000  XML::SAX::Base::start_element
 1.49   0.143  0.580  49365   0.0000 0.0000  XML::NamespaceSupport::process_element_name
LVL 1
timdrAsked:
Who is Participating?
 
ps15Commented:
One of the fastes ways of parsing XML ist event based with XML::Sax

See Also:
http://search.cpan.org/dist/XML-SAX/SAX.pm
http://search.cpan.org/dist/XML-SAX/SAX/Intro.pod
0
 
ozoCommented:
What kind of processing do you need to do on the input and output?
If you do not need full XML parsing, there may be some short cuts you could take.
0
 
timdrAuthor Commented:
I don't know if I can do anything but full XML parsing, but i will definitely look into these. What about for regular full xml parsing, is there anythign faster then what I'm using? The reason I ask is because I just recently found that installing XML::SAX greatly increased the speed of things, without any change in code (still using XML::Simple), so I'm trying to find anything else I can install that would help.

If not, I'll see what I can do about the event based parsing.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.