As far as XML parsers go, XML::Bare is one of the fastest. Since it was released there are some other faster parsers, but they exchange faster parsing for slower access to the data once parsed.

Based on what you are saying, you are outputting all, or most of your data each time you parse. Because of this it is unlikely to could gain higher speed via another parser.

There are speed losses because an in between structure is created ( a perl hash ). That is bloated and inefficient when you have large XML files ( over 3 MB ). If you have XML files that large you should look at using a SAX parser. XML::Bare has a SAX parser as well, but it is pre-beta and very unstable. ( there are a bunch of other SAX parsers on CPAN )

Note that I wrote XML::Bare, and have been using it in a way similar to what you are describing for the last several years, so I am sort of biased.

Note also that there are various glitches and problems with the current version of XML::Bare. The biggest one is that you cannot have nodes named value ex: '<value>'. Using such a node -will- crash the parser.

In reply to Re: XSL transformation vs. parsing of html - Performance benefits by codechild
in thread XSL transformation vs. parsing of html - Performance benefits by DreamT

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.