OK I added this one

Extra code is

$backend = 'XML::SAX::ExpatXS'; my $xml_x_s_exs; { local $ENV{XML_SIMPLE_PREFERRED_PARSER} = $backend; $start = time(); $xml_x_s_exs = $xs->XMLin($XMLFile); $end = time(); } print_result($backend, $end, $start, $size); ... is_deeply($xml_default, $xml_x_s_exs);

New results are

[le6303@itdevtst perl]$ ./xml.pl bigxml.xml File bigxml.xml is 1730463 bytes XML::Simple with default backend took 12.7477 seconds. This equates to + 135747.5992 kilobytes per second (1024 bytes per k) XML::Simple with XML::Parser backend took 3.5870 seconds. This equates + to 482431.8874 kilobytes per second (1024 bytes per k) XML::Simple with XML::SAX::Expat backend took 13.7021 seconds. This eq +uates to 126292.1408 kilobytes per second (1024 bytes per k) XML::Simple with XML::SAX::ExpatXS backend took 5.9447 seconds. This e +quates to 291093.0139 kilobytes per second (1024 bytes per k) XML::Simple with XML::LibXML::SAX backend took 6.5013 seconds. This eq +uates to 266172.9123 kilobytes per second (1024 bytes per k) ok 1 ok 2 ok 3 ok 4 1..4

So a good result, but the ol' original XML::Parser is still faster. ExpatXS may be a faster parser, but it may not be as effective as a SAX generator. More research is required - anyone, anyone...

I may get time on the weekend to try these with some more types of XML document e.g. one that references external entities (standalone="false"), large UUencoded binary blobs in CDATA sections, very small files etc

use brain;


In reply to Re^2: XML::Simple Benchmarks with various backends by leriksen
in thread XML::Simple Benchmarks with various backends by leriksen

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.